schema_salad.codegen_base
Base class for the generation of loaders from schema-salad definitions.
Module Contents
Classes
Schema Salad type description. |
|
Abstract base class for schema salad code generators. |
- class schema_salad.codegen_base.TypeDef(name, init, is_uri=False, scoped_id=False, ref_scope=0, loader_type=None, instance_type=None, abstract=False)
Schema Salad type description.
- Parameters:
- __slots__ = ['name', 'init', 'is_uri', 'scoped_id', 'ref_scope', 'loader_type', 'instance_type', 'abstract']
- class schema_salad.codegen_base.CodeGenBase
Abstract base class for schema salad code generators.
- declare_type(declared_type)
Add this type to our collection, if needed.
- add_vocab(name, uri)
Add the given name as an abbreviation for the given URI.
- abstract prologue()
Trigger to generate the prolouge code.
- Return type:
None
- abstract static safe_name(name)
Generate a safe version of the given name.
- abstract begin_class(classname, extends, doc, abstract, field_names, idfield, optional_fields)
Produce the header for the given class.
- abstract end_class(classname, field_names)
Signal that we are done with this class.
- abstract type_loader(type_declaration)
Parse the given type declaration and declare its components.
- abstract declare_field(name, fieldtype, doc, optional, subscope)
Output the code to load the given field.
- abstract declare_id_field(name, fieldtype, doc, optional)
Output the code to handle the given ID field.
- abstract uri_loader(inner, scoped_id, vocab_term, ref_scope)
Construct the TypeDef for the given URI loader.
- abstract idmap_loader(field, inner, map_subject, map_predicate)
Construct the TypeDef for the given mapped ID loader.
- abstract typedsl_loader(inner, ref_scope)
Construct the TypeDef for the given DSL loader.