mavsec.schema.Schema

class mavsec.schema.Schema

Bases: ABC

__init__()

Methods

__init__()

from_dict(data)

Get a cls object from a dictionary.

from_file(path)

Get a cls object from a file.

from_json(path)

Get a cls object from a JSON file.

from_toml(path)

Get a cls object from a TOML file.

from_yaml(path)

Get a cls object from a YAML file.

to_dict()

Convert the object to a dictionary.

to_json(path)

Write the object to a JSON file.

to_toml(path)

Write the object to a TOML file.

to_yaml(path)

Write the object to a YAML file.

classmethod from_dict(data: dict) SchemaT

Get a cls object from a dictionary.

Parameters:

data (dict) – The dictionary to convert to a cls object.

Returns:

The Schema object.

Return type:

cls

classmethod from_file(path: str | Path) SchemaT

Get a cls object from a file.

Parameters:

path (str) – The path to the file.

Returns:

The cls object.

Return type:

cls

classmethod from_json(path: str | Path) SchemaT

Get a cls object from a JSON file.

Parameters:

path (str) – The path to the JSON file.

Returns:

The cls object.

Return type:

cls

classmethod from_toml(path: str | Path) SchemaT

Get a cls object from a TOML file.

Parameters:

path (str) – The path to the TOML file.

Returns:

The cls object.

Return type:

cls

classmethod from_yaml(path: str | Path) SchemaT

Get a cls object from a YAML file.

Parameters:

path (str) – The path to the YAML file.

Returns:

The cls object.

Return type:

cls

abstract to_dict() dict

Convert the object to a dictionary.

Returns:

The dictionary.

Return type:

dict

to_json(path: str | Path) None

Write the object to a JSON file.

Parameters:

path (str) – The path to the JSON file.

to_toml(path: str | Path) None

Write the object to a TOML file.

Parameters:

path (str) – The path to the TOML file.

to_yaml(path: str | Path) None

Write the object to a YAML file.

Parameters:

path (str) – The path to the YAML file.