adorn.data.constructor module

A container of information relevant for constructing an object.

class adorn.data.constructor.Constructor(subclass)

Bases: object

Container holding the class and relevant metadata to construct an object.

Parameters

subclass (_UnitT) – The type to generate construction metadata for

Return type

None

infer_params(target_class, constructor)

Generate a dict containing all the parameters needed to instantiate subclass.

This method is recursive and will convert **kwargs, specified in the constructor, to the relevant parameters of its parent class(es), given the parent(s) subclass Complex

Parameters
  • target_class (Type["_T"]) – The class you are interegating the constructor of. This argument is used to explode the **kwargs

  • constructor (Callable[..., "_T"]) – The method, whose parameters will be added to a dictionary

Returns

constructor parameters as a dict

keys are the parameter names and values are the parameter metadata

Return type

Dict[str, inspect.Parameter]

subclass: _UnitT