schema_salad.python_codegen
===========================

.. py:module:: schema_salad.python_codegen

.. autoapi-nested-parse::

   Python code generator for a given schema salad definition.



Attributes
----------

.. autoapisummary::

   schema_salad.python_codegen.black
   schema_salad.python_codegen.prims


Classes
-------

.. autoapisummary::

   schema_salad.python_codegen.PythonCodeGen


Functions
---------

.. autoapisummary::

   schema_salad.python_codegen.fmt


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

.. py:data:: black
   :value: None


.. py:data:: prims
   :type:  Final

.. py:function:: fmt(text, indent)

   Use black to format this snippet.

   :param indent the indent level for the current context


.. py:class:: PythonCodeGen(out, copyright, parser_info, salad_version)

   Bases: :py:obj:`schema_salad.codegen_base.CodeGenBase`

   .. autoapi-inheritance-diagram:: schema_salad.python_codegen.PythonCodeGen
      :parts: 1


   Generation of Python code for a given Schema Salad definition.


   .. py:attribute:: out
      :type:  Final


   .. py:attribute:: current_class_is_abstract
      :value: False



   .. py:attribute:: serializer


   .. py:attribute:: idfield
      :value: ''



   .. py:attribute:: copyright
      :type:  Final


   .. py:attribute:: parser_info
      :type:  Final


   .. py:attribute:: salad_version
      :type:  Final


   .. py:method:: safe_name(name)
      :staticmethod:


      Generate a safe version of the given name.



   .. py:method:: prologue()

      Trigger to generate the prolouge code.



   .. py:method:: begin_class(classname, extends, doc, abstract, field_names, idfield, optional_fields)

      Produce the header for the given class.



   .. py:method:: end_class(classname, field_names)

      Signal that we are done with this class.



   .. py:method:: type_loader(type_declaration, container = None, no_link_check = None)

      Parse the given type declaration and declare its components.



   .. py:method:: declare_id_field(name, fieldtype, doc, optional)

      Output the code to handle the given ID field.



   .. py:method:: declare_field(name, fieldtype, doc, optional, subscope)

      Output the code to load the given field.



   .. py:method:: uri_loader(inner, scoped_id, vocab_term, ref_scope, no_link_check = None)

      Construct the TypeDef for the given URI loader.



   .. py:method:: idmap_loader(field, inner, map_subject, map_predicate)

      Construct the TypeDef for the given mapped ID loader.



   .. py:method:: typedsl_loader(inner, ref_scope)

      Construct the TypeDef for the given DSL loader.



   .. py:method:: secondaryfilesdsl_loader(inner)

      Construct the TypeDef for secondary files.



   .. py:method:: epilogue(root_loader)

      Trigger to generate the epilouge code.



