hdmf.build.classgenerator module
- class hdmf.build.classgenerator.ClassGenerator
Bases:
object
- property custom_generators
- register_generator(generator)
Add a custom class generator to this ClassGenerator.
Generators added later are run first. Duplicates are moved to the top of the list.
- Parameters:
generator (
type
) – the CustomClassGenerator class to register
- generate_class(data_type, spec, parent_cls, attr_names, type_map, post_init_method=None)
- Get the container class from data type specification.
If no class has been associated with the
data_type
fromnamespace
, a class will be dynamically created and returned.
- Parameters:
- Returns:
the class for the given namespace and data_type
- Return type:
- class hdmf.build.classgenerator.CustomClassGenerator(*args, **kwargs)
Bases:
object
Subclass this class and register an instance to alter how classes are auto-generated.
- classmethod apply_generator_to_field(field_spec, bases, type_map)
Return True to signal that this generator should return on all fields not yet processed.
- classmethod process_field_spec(classdict, docval_args, parent_cls, attr_name, not_inherited_fields, type_map, spec)
Add __fields__ to the classdict and update the docval args for the field spec with the given attribute name. :param classdict: The dict to update with __fields__ (or a different parent_cls._fieldsname). :param docval_args: The list of docval arguments. :param parent_cls: The parent class. :param attr_name: The attribute name of the field spec for the container class to generate. :param not_inherited_fields: Dictionary of fields not inherited from the parent class. :param type_map: The type map to use. :param spec: The spec for the container class to generate.
- classmethod post_process(classdict, bases, docval_args, spec)
Convert classdict[‘__fields__’] to tuple and update docval args for a fixed name and default name. :param classdict: The class dictionary to convert with ‘__fields__’ key (or a different bases[0]._fieldsname) :param bases: The list of base classes. :param docval_args: The dict of docval arguments. :param spec: The spec for the container class to generate.
- classmethod set_init(classdict, bases, docval_args, not_inherited_fields, name)
- class hdmf.build.classgenerator.MCIClassGenerator(*args, **kwargs)
Bases:
CustomClassGenerator
- classmethod apply_generator_to_field(field_spec, bases, type_map)
Return True if the field spec has quantity * or +, False otherwise.
- classmethod process_field_spec(classdict, docval_args, parent_cls, attr_name, not_inherited_fields, type_map, spec)
Add __clsconf__ to the classdict and update the docval args for the field spec with the given attribute name. :param classdict: The dict to update with __clsconf__. :param docval_args: The list of docval arguments. :param parent_cls: The parent class. :param attr_name: The attribute name of the field spec for the container class to generate. :param not_inherited_fields: Dictionary of fields not inherited from the parent class. :param type_map: The type map to use. :param spec: The spec for the container class to generate.
- classmethod post_process(classdict, bases, docval_args, spec)
Add MultiContainerInterface to the list of base classes. :param classdict: The class dictionary. :param bases: The list of base classes. :param docval_args: The dict of docval arguments. :param spec: The spec for the container class to generate.
- classmethod set_init(classdict, bases, docval_args, not_inherited_fields, name)