mavsec.properties.Property
- class mavsec.properties.Property(name: 'str', description: 'str', meta: 'dict[str, Any]' = <factory>, ptype: 'PropertyType | str | None' = None, preconditions: 'list[str] | None' = None)
Bases:
Schema- __init__(name: str, description: str, meta: dict[str, ~typing.Any] = <factory>, ptype: ~mavsec.properties.PropertyType | str | None = None, preconditions: list[str] | None = None) None
Methods
__init__(name, description[, meta, ptype, ...])Returns all the available property types.
check()Check the property.
from_dict(d)Converts the SVP principle to a property.
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.
Gets the preconditions for the property.
ptype_from_str(prop)Gets a property type from a string.
set_preconditions(preconditions)Sets the preconditions for the property.
to_dict()Convert the object to a dictionary.
to_json(path)Write the object to a JSON file.
to_svp()Converts the property to an SVP principle.
to_toml(path)Write the object to a TOML file.
to_yaml(path)Write the object to a YAML file.
Gets the name of the property type.
Attributes
The preconditions for the property.
The type of the property.
The name of the property.
A brief description of the property.
A dictionary of metadata for the property.
- classmethod available_types() list[PropertyType]
Returns all the available property types.
- check() ProjectCheckResult
Check the property.
- description: str
A brief description of the property.
- 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
- get_preconditions() str
Gets the preconditions for the property.
- meta: dict[str, Any]
A dictionary of metadata for the property.
- name: str
The name of the property.
- preconditions: list[str] | None = None
The preconditions for the property.
- ptype: PropertyType | str | None = None
The type of the property.
- classmethod ptype_from_str(prop: str) PropertyType
Gets a property type from a string.
- set_preconditions(preconditions: str | list[str]) None
Sets the preconditions for the property.
- to_dict() dict
Convert the object to a dictionary.
- to_json(path: str | Path) None
Write the object to a JSON file.
- Parameters:
path (str) – The path to the JSON file.
- to_svp() str
Converts the property to an SVP principle.
- 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.
- type_name() str
Gets the name of the property type.