schema_salad.python_codegen_support
===================================

.. py:module:: schema_salad.python_codegen_support

.. autoapi-nested-parse::

   Template code used by python_codegen.py.



Attributes
----------

.. autoapisummary::

   schema_salad.python_codegen_support.IdxType
   schema_salad.python_codegen_support.S
   schema_salad.python_codegen_support.save_type


Classes
-------

.. autoapisummary::

   schema_salad.python_codegen_support.LoadingOptions
   schema_salad.python_codegen_support.Saveable


Functions
---------

.. autoapisummary::

   schema_salad.python_codegen_support.load_field
   schema_salad.python_codegen_support.extract_type
   schema_salad.python_codegen_support.convert_typing
   schema_salad.python_codegen_support.parse_errors
   schema_salad.python_codegen_support.save
   schema_salad.python_codegen_support.save_with_metadata
   schema_salad.python_codegen_support.expand_url
   schema_salad.python_codegen_support.file_uri
   schema_salad.python_codegen_support.prefix_url
   schema_salad.python_codegen_support.save_relative_uri
   schema_salad.python_codegen_support.shortname


Module Contents
---------------

.. py:type:: IdxType
   :canonical: MutableMapping[str, tuple[Any, 'LoadingOptions']]


.. py:data:: S

.. py:class:: 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)

   .. py:attribute:: idx
      :type:  Final[IdxType]


   .. py:attribute:: fileuri
      :type:  Final[str | None]


   .. py:attribute:: baseuri
      :type:  Final[str]


   .. py:attribute:: namespaces
      :type:  Final[collections.abc.MutableMapping[str, str]]


   .. py:attribute:: schemas
      :type:  Final[collections.abc.MutableSequence[str]]


   .. py:attribute:: original_doc
      :type:  Final[Any | None]


   .. py:attribute:: addl_metadata
      :type:  Final[collections.abc.MutableMapping[str, Any]]


   .. py:attribute:: fetcher
      :type:  Final[schema_salad.fetcher.Fetcher]


   .. py:attribute:: vocab
      :type:  Final[dict[str, str]]


   .. py:attribute:: rvocab
      :type:  Final[dict[str, str]]


   .. py:attribute:: cache
      :type:  Final[schema_salad.utils.CacheType]


   .. py:attribute:: imports
      :type:  Final[list[str]]


   .. py:attribute:: includes
      :type:  Final[list[str]]


   .. py:attribute:: no_link_check
      :type:  Final[bool | None]


   .. py:attribute:: container
      :type:  Final[str | None]


   .. py:property:: graph
      :type: rdflib.Graph


      Generate a merged rdflib.Graph from all entries in self.schemas.



.. py:class:: Saveable

   Mark classes than have a save() and fromDoc() function.


   .. py:method:: fromDoc(_doc, baseuri, loadingOptions, docRoot = None)
      :classmethod:

      :abstractmethod:


      Construct this object from the result of yaml.load().



   .. py:method:: save(top = False, base_url = '', relative_uris = True)
      :abstractmethod:


      Convert this object to a JSON/YAML friendly dictionary.



.. py:function:: load_field(val, fieldtype, baseuri, loadingOptions, lc = None)

   Load field.


.. py:type:: save_type
   :canonical: None | MutableMapping[str, Any] | MutableSequence[Any] | int | float | bool | str


.. py:function:: extract_type(val_type)

   Take a type of value, and extracts the value as a string.


.. py:function:: convert_typing(val_type)

   Normalize type names to schema-salad types.


.. py:function:: parse_errors(error_message)

   Parse error messages from several loaders into one error message.


.. py:function:: save(val, top = True, base_url = '', relative_uris = True)

.. py:function:: 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.


.. py:function:: expand_url(url, base_url, loadingOptions, scoped_id = False, vocab_term = False, scoped_ref = None)

.. py:function:: file_uri(path, split_frag = False)

   Transform a file path into a URL with file scheme.


.. py:function:: prefix_url(url, namespaces)

   Expand short forms into full URLs using the given namespace dictionary.


.. py:function:: save_relative_uri(uri, base_url, scoped_id, ref_scope, relative_uris)

   Convert any URI to a relative one, obeying the scoping rules.


.. py:function:: shortname(inputid)

   Compute the shortname of a fully qualified identifier.

   See https://w3id.org/cwl/v1.2/SchemaSalad.html#Short_names.


