bibliopixel.project.construct module¶
-
bibliopixel.project.construct.
construct
(*args, datatype, typename=None, **kwds)[source]¶ Construct an object from a type constructor.
A type constructor is a dictionary which has a field “datatype” which has a callable method to construct a class, and a field “typename” which is the Python path of the function or class in “datatype”.
-
bibliopixel.project.construct.
to_type_constructor
(value, python_path=None)[source]¶ ” Tries to convert a value to a type constructor.
If value is a string, then it used as the “typename” field.
If the “typename” field exists, the symbol for that name is imported and added to the type constructor as a field “datatype”.
- Throws:
- ImportError – if “typename” is set but cannot be imported ValueError – if “typename” is malformed