schema_salad.python_codegen_support
Template code used by python_codegen.py.
Module Contents
Classes
Mark classes than have a save() and fromDoc() function. |
Functions
|
|
|
|
|
Save and set $namespaces, $schemas, $base and any other metadata fields at the top level. |
|
|
|
|
|
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. |
Attributes
- 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)
- Parameters:
fetcher (Optional[schema_salad.fetcher.Fetcher]) –
schemas (Optional[List[str]]) –
fileuri (Optional[str]) –
copyfrom (Optional[LoadingOptions]) –
original_doc (Optional[Any]) –
baseuri (Optional[str]) –
idx (Optional[IdxType]) –
imports (Optional[List[str]]) –
includes (Optional[List[str]]) –
- property graph: rdflib.Graph
Generate a merged rdflib.Graph from all entries in self.schemas.
- Return type:
- idx: IdxType
- fetcher: schema_salad.fetcher.Fetcher
- cache: schema_salad.utils.CacheType
- class schema_salad.python_codegen_support.Saveable
Bases:
digraph inheritance09618532e3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "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",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.
- abstract classmethod fromDoc(_doc, baseuri, loadingOptions, docRoot=None)
Construct this object from the result of yaml.load().
- Parameters:
_doc (Any) –
baseuri (str) –
loadingOptions (LoadingOptions) –
docRoot (Optional[str]) –
- Return type:
- schema_salad.python_codegen_support.load_field(val, fieldtype, baseuri, loadingOptions)
- Parameters:
fieldtype (_Loader) –
baseuri (str) –
loadingOptions (LoadingOptions) –
- Return type:
Any
- schema_salad.python_codegen_support.save_type
- 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)
- 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.