cis_interface.metaschema package¶
Subpackages¶
- cis_interface.metaschema.datatypes package
- Subpackages
- cis_interface.metaschema.datatypes.tests package
- Submodules
- cis_interface.metaschema.datatypes.tests.test_ArrayMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_ContainerMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_FunctionMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_JSONArrayMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_JSONMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_JSONObjectMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_MetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_ObjMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_PlyMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_ScalarMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_SchemaMetaschemaType module
- cis_interface.metaschema.datatypes.tests.test_conversions module
- Module contents
- cis_interface.metaschema.datatypes.tests package
- Submodules
- cis_interface.metaschema.datatypes.ArrayMetaschemaType module
- cis_interface.metaschema.datatypes.ContainerMetaschemaType module
- cis_interface.metaschema.datatypes.FixedMetaschemaType module
- cis_interface.metaschema.datatypes.FunctionMetaschemaType module
- cis_interface.metaschema.datatypes.JSONArrayMetaschemaType module
- cis_interface.metaschema.datatypes.JSONMetaschemaType module
- cis_interface.metaschema.datatypes.JSONObjectMetaschemaType module
- cis_interface.metaschema.datatypes.MetaschemaType module
- cis_interface.metaschema.datatypes.ObjMetaschemaType module
- cis_interface.metaschema.datatypes.PlyMetaschemaType module
- cis_interface.metaschema.datatypes.ScalarMetaschemaType module
- cis_interface.metaschema.datatypes.SchemaMetaschemaType module
- cis_interface.metaschema.datatypes.conversions module
- Module contents
- Subpackages
- cis_interface.metaschema.properties package
- Subpackages
- cis_interface.metaschema.properties.tests package
- Submodules
- cis_interface.metaschema.properties.tests.test_ArrayMetaschemaProperties module
- cis_interface.metaschema.properties.tests.test_JSONArrayMetaschemaProperties module
- cis_interface.metaschema.properties.tests.test_JSONObjectMetaschemaProperties module
- cis_interface.metaschema.properties.tests.test_MetaschemaProperty module
- cis_interface.metaschema.properties.tests.test_ScalarMetaschemaProperties module
- cis_interface.metaschema.properties.tests.test_TypeMetaschemaProperty module
- Module contents
- cis_interface.metaschema.properties.tests package
- Submodules
- cis_interface.metaschema.properties.ArrayMetaschemaProperties module
- cis_interface.metaschema.properties.DefaultProperty module
- cis_interface.metaschema.properties.JSONArrayMetaschemaProperties module
- cis_interface.metaschema.properties.JSONObjectMetaschemaProperties module
- cis_interface.metaschema.properties.MetaschemaProperty module
- cis_interface.metaschema.properties.ScalarMetaschemaProperties module
- cis_interface.metaschema.properties.TitleMetaschemaProperty module
- cis_interface.metaschema.properties.TypeMetaschemaProperty module
- Module contents
- Subpackages
- cis_interface.metaschema.tests package
Submodules¶
cis_interface.metaschema.encoder module¶
-
class
cis_interface.metaschema.encoder.
JSONReadableEncoder
(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶ Bases:
json.encoder.JSONEncoder
Encoder class for CiS messages.
-
cis_interface.metaschema.encoder.
decode_json
(msg, **kwargs)[source]¶ Decode a Python object from a JSON serialization.
Parameters: - msg (str) – JSON serialization to decode.
- **kwargs – Additional keyword arguments are passed to json.loads.
Returns: Deserialized Python object.
Return type:
-
cis_interface.metaschema.encoder.
encode_json
(obj, fd=None, indent=None, sort_keys=True, **kwargs)[source]¶ Encode a Python object in JSON format.
Parameters: - obj (object) – Python object to encode.
- fd (file, optional) – File descriptor for file that encoded object should be written to. Defaults to None and string is returned.
- indent (int, str, optional) – Indentation for new lines in encoded string. Defaults to None.
- sort_keys (bool, optional) – If True, the keys will be output in sorted order. Defaults to True.
- **kwargs – Additional keyword arguments are passed to json.dumps.
Returns: Encoded object.
Return type:
-
cis_interface.metaschema.encoder.
indent_char2int
(indent)[source]¶ Convert a character indent into a number of spaces that should be used. Tabs are set to be equivalent to 4 spaces.
Parameters: indent (str) – String indent. Returns: Number of whitespaces that is equivalent to the provided string. Return type: int
cis_interface.metaschema.normalizer module¶
-
class
cis_interface.metaschema.normalizer.
UndefinedProperty
[source]¶ Bases:
object
Class to be used as a flag for undefined properties.
-
class
cis_interface.metaschema.normalizer.
UninitializedNormalized
[source]¶ Bases:
object
Class to be used as a flag for uninitialized normalized value.
-
cis_interface.metaschema.normalizer.
create
(*args, **kwargs)[source]¶ Dynamically create a validation/normalization class that subclasses the jsonschema validation class.
Parameters: - normalizers (dict, optional) – Keys are tuples representing paths that exist within the schema at which the normalization functions stored in lists as their value counterparts should be executed. Defaults to empty dictionary.
- no_defaults (bool, optional) – If True, defaults will not be set during normalization. Defaults to False.
- required_defaults (bool, optional) – If True, defaults will be set for required properties, even if no_defaults is True. Defaults to False.
- *args – Additional arguments are passed to jsonschema.validators.create.
- **kwargs – Additional keyword arguments are passed to jsonschema.validators.create.
Module contents¶
-
cis_interface.metaschema.
create_metaschema
(overwrite=False)[source]¶ Create the meta schema for validating cis schema.
Parameters: overwrite (bool, optional) – If True, the existing meta schema will be overwritten. If False and the metaschema exists, an error will be raised. Defaults to False. Returns: - Meta schema specifying rules for cis type schema. This includes
- all original JSON schema rules with the addition of types and property definitions.
Return type: dict Raises: RuntimeError
– If the file already exists and overwrite is False.
-
cis_interface.metaschema.
get_metaschema
()[source]¶ Return the meta schema for validating cis schema.
Returns: - Meta schema specifying rules for cis type schema. This includes
- all original JSON schema rules with the addition of types and property definitions.
Return type: dict Note
This function should not be called at the module level as it can cause the metaschema (if it dosn’t exist) to be generated before all of the necessary modules have been loaded.
-
cis_interface.metaschema.
get_validator
(overwrite=False, normalizers=None, **kwargs)[source]¶ Return the validator that includes cis expansion types.
Parameters: Returns: JSON schema validator.
Return type: jsonschema.IValidator
-
cis_interface.metaschema.
import_all_classes
()[source]¶ Import all metaschema classes (types and properties).
-
cis_interface.metaschema.
normalize_instance
(obj, schema, **kwargs)[source]¶ Normalize an object using the provided schema.
Parameters: Returns: Normalized instance.
Return type: