pg.ObjectFactory

Accessible via pg.ObjectFactory, pg.patching.ObjectFactory.

class ObjectFactory(value_type, base_value, patches=None, params_override=None)

Bases: pg.Functor

A factory to create symbolic object from a base value and patches.

Parameters:
  • value_type – Type of return value.

  • base_value – An instance of value_type, or a callable object that produces an instance of value_type, or a string as the path to the serialized value.

  • patches – Optional patching rules. See patch for details.

  • params_override – A rebind dict (or a JSON string as serialized rebind dict) as an additional patch to the value,

Returns:

Value after applying patchers and params_override based on base_value.