blackfennec.structure package
Subpackages
- blackfennec.structure.reference_navigation package
- Submodules
- blackfennec.structure.reference_navigation.child_navigator module
- blackfennec.structure.reference_navigation.index_of_navigator module
- blackfennec.structure.reference_navigation.navigator module
- blackfennec.structure.reference_navigation.parent_navigator module
- blackfennec.structure.reference_navigation.root_navigator module
- blackfennec.structure.reference_navigation.sibling_offset_navigator module
- blackfennec.structure.reference_navigation.uri_navigator module
- Module contents
Submodules
blackfennec.structure.boolean module
blackfennec.structure.list module
- class blackfennec.structure.list.List(value: Optional[list[T]] = None)[source]
Bases:
Structure
[list
[T
]]Core type List, a list of Structures
- remove_item(item: T) None [source]
Remove item from List.
- Parameters
item (Structure) – Item to remove.
- Raises
KeyError – If the item passed is not in list and hence cannot be removed.
- property value: list[T]
Property for value of this structure.
blackfennec.structure.map module
- class blackfennec.structure.map.Map(value: Optional[dict[str, T]] = None)[source]
Bases:
Structure
[dict
[str
,T
]]Core type Map, a set of keys with values
- add_item(key: str, value: T) None [source]
Custom set item hook, adds self as parent or raises error.
- Parameters
key (str) – The key for the inserted item.
value (Structure) – The item which will be inserted.
- Raises
ValueError – If the key already exists
- remove_item(key: str) None [source]
Custom delete hook, resets parent for removed structure.
- Parameters
key (any) – The key of the item to delete.
- Raises
KeyError – If the item with the key to delete is not contained in map.
- property value: dict[str, T]
Property for value of this structure.
blackfennec.structure.null module
blackfennec.structure.number module
blackfennec.structure.reference module
- class blackfennec.structure.reference.Reference(navigators: list[blackfennec.structure.reference_navigation.navigator.Navigator])[source]
Bases:
Structure
[list
[Navigator
]]Core Type Reference, represents references in the domain model.
- TYPE = None
- resolve() Structure [source]
Resolves Reference navigation
- Returns
destination to which the reference_navigation points
- Return type
- property value: list[blackfennec.structure.reference_navigation.navigator.Navigator]
Property for value of this structure.
blackfennec.structure.string module
blackfennec.structure.structure module
- class blackfennec.structure.structure.Structure[source]
Bases:
Observable
,Generic
[T
]Abstract base class for all types (Structures).
- property structure
- abstract property value: T
Property for value of this structure.
blackfennec.structure.structure_serializer module
- class blackfennec.structure.structure_serializer.StructureSerializer(reference_serializer: JsonReferenceSerializer)[source]
Bases:
object
Serializer allows black-fennec structures to be serialized to native Python datatypes and vice versa
- deserialize(raw: Optional[Union[dict, list, str, bool, Number]]) Structure [source]
Checks if object is an instance of a specific type and returns the parsed black-fennec structure
- Parameters
raw (Union[dict, list, str, bool, numbers.Number, None]) – native Python datatype
- Returns
Subclass of Structure
- Return type
- Raises
NotImplementedError – If the type contained in the passed native Python datatype is unhandled.
- serialize(structure: Structure) Optional[Union[dict, list, str, bool, Number]] [source]
Serializes a black-fennec structure to a native Python datatype
- Parameters
structure (Structure) – A black-fennec structure
- Returns
A native Python datatype
- Return type
Union[dict, list, str, bool, numbers.Number, None]
- Raises
NotImplementedError – If the type contained in the passed Structure is unhandled