schema_salad.python_codegen_support
Template code used by python_codegen.py.
Attributes
Classes
Mark classes than have a save() and fromDoc() function. |
Functions
|
Load field. |
|
Take a type of value, and extracts the value as a string. |
|
Normalize type names to schema-salad types. |
|
Parse error messages from several loaders into one error message. |
|
|
|
Save and set $namespaces, $schemas, $base and any other metadata fields at the top level. |
|
|
|
Transform a file path into a URL with file scheme. |
|
Expand short forms into full URLs using the given namespace dictionary. |
|
Convert any URI to a relative one, obeying the scoping rules. |
|
Compute the shortname of a fully qualified identifier. |
Module Contents
- schema_salad.python_codegen_support.IdxType
- class schema_salad.python_codegen_support.LoadingOptions(fetcher=None, namespaces=None, schemas=None, fileuri=None, copyfrom=None, original_doc=None, addl_metadata=None, baseuri=None, idx=None, imports=None, includes=None, no_link_check=None, container=None)
- Parameters:
fetcher (Optional[schema_salad.fetcher.Fetcher])
fileuri (Optional[str])
copyfrom (Optional[LoadingOptions])
original_doc (Optional[Any])
baseuri (Optional[str])
idx (Optional[IdxType])
no_link_check (Optional[bool])
container (Optional[str])
- idx: IdxType
- namespaces: collections.abc.MutableMapping[str, str]
- schemas: collections.abc.MutableSequence[str]
- addl_metadata: collections.abc.MutableMapping[str, Any]
- fetcher: schema_salad.fetcher.Fetcher
- cache: schema_salad.utils.CacheType
- property graph: rdflib.Graph
Generate a merged rdflib.Graph from all entries in self.schemas.
- Return type:
- class schema_salad.python_codegen_support.Saveable
Bases:
digraph inheritance09618532e3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [URL="https://docs.python.org/3/library/abc.html#abc.ABC",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Helper class that provides a standard way to create an ABC using"]; "Saveable" [URL="#schema_salad.python_codegen_support.Saveable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mark classes than have a save() and fromDoc() function."]; "ABC" -> "Saveable" [arrowsize=0.5,style="setlinewidth(0.5)"]; }abc.ABC
Mark classes than have a save() and fromDoc() function.
- classmethod fromDoc(_doc, baseuri, loadingOptions, docRoot=None)
- Abstractmethod:
- Parameters:
_doc (Any)
baseuri (str)
loadingOptions (LoadingOptions)
docRoot (Optional[str])
- Return type:
Construct this object from the result of yaml.load().
- schema_salad.python_codegen_support.load_field(val, fieldtype, baseuri, loadingOptions, lc=None)
Load field.
- schema_salad.python_codegen_support.save_type
- schema_salad.python_codegen_support.extract_type(val_type)
Take a type of value, and extracts the value as a string.
- schema_salad.python_codegen_support.convert_typing(val_type)
Normalize type names to schema-salad types.
- schema_salad.python_codegen_support.parse_errors(error_message)
Parse error messages from several loaders into one error message.
- schema_salad.python_codegen_support.save(val, top=True, base_url='', relative_uris=True)
- schema_salad.python_codegen_support.save_with_metadata(val, valLoadingOpts, top=True, base_url='', relative_uris=True)
Save and set $namespaces, $schemas, $base and any other metadata fields at the top level.
- Parameters:
val (Any)
valLoadingOpts (LoadingOptions)
top (bool)
base_url (str)
relative_uris (bool)
- Return type:
save_type
- schema_salad.python_codegen_support.expand_url(url, base_url, loadingOptions, scoped_id=False, vocab_term=False, scoped_ref=None)
- schema_salad.python_codegen_support.file_uri(path, split_frag=False)
Transform a file path into a URL with file scheme.
- schema_salad.python_codegen_support.prefix_url(url, namespaces)
Expand short forms into full URLs using the given namespace dictionary.
- schema_salad.python_codegen_support.save_relative_uri(uri, base_url, scoped_id, ref_scope, relative_uris)
Convert any URI to a relative one, obeying the scoping rules.
- schema_salad.python_codegen_support.shortname(inputid)
Compute the shortname of a fully qualified identifier.