blackfennec.layers.encapsulation_base package

Submodules

blackfennec.layers.encapsulation_base.base_factory_visitor module

class blackfennec.layers.encapsulation_base.base_factory_visitor.BaseFactoryVisitor(layer, layer_base_class)[source]

Bases: Visitor[T]

Abstract Factory and Visitor

This class implements the base visitor behaviour

and returns the input wrapped in an adapter/decorator like manner while caching the generated generic adapter/decorator classes.

Python does not support overloading by Type, thus the visit

function are present for all existing core types.

visit_boolean(subject: Boolean) T[source]
visit_list(subject: List) T[source]
visit_map(subject: Map) T[source]
visit_null(subject: Null) T[source]
visit_number(subject: Number) T[source]
visit_reference(subject: Reference) T[source]
visit_string(subject: String) T[source]
visit_structure(subject: Structure) T[source]

blackfennec.layers.encapsulation_base.encapsulation_base module

class blackfennec.layers.encapsulation_base.encapsulation_base.EncapsulationBase(layer, subject: Structure)[source]

Bases: Structure, ChangeNotificationDispatchMixin

Is the base class of the abstract visitor BaseFactoryVisitor, which means that any created object of the abstract visitor has the super class EncapsulationBase or a specialisation.

accept(visitor)[source]
bind(**kwargs)[source]
property parent

Property for parent of this structure encapsulated in a EncapsulationBase.

property root

Property for root of this structure encapsulated in an FactoryBase.

Returns

encapsulates root of subject in FactoryBase class

Return type

EncapsulationBase

property structure
property subject

Property for access on encapsulated structure in this EncapsulationBase.

property value

Property for value of this structure.

blackfennec.layers.encapsulation_base.list_encapsulation_base module

class blackfennec.layers.encapsulation_base.list_encapsulation_base.ListEncapsulationBase(**kwargs)[source]

Bases: EncapsulationBase, List

Base Class for ecapsulations of a List.

Contains List specific overrides of certain functions

to ensure the encapsulation of any Structure returned in order to stay in the encapsulation layer.

add_item(item: Structure)[source]

Append item to list type.

Parameters

item (Structure) – Item to append.

remove_item(item: Structure)[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.

replace_item(old_item: Structure, new_item: Structure) None[source]

Replace old_item with new_item.

Parameters
  • old_item (Structure) – Item to be replaced.

  • new_item (Structure) – Item to replace with.

Raises

KeyError – If old_item is not in list.

property subject: List

Property for access on encapsulated structure in this EncapsulationBase.

property value

Property for value of this structure.

blackfennec.layers.encapsulation_base.map_encapsulation_base module

class blackfennec.layers.encapsulation_base.map_encapsulation_base.MapEncapsulationBase(**kwargs)[source]

Bases: EncapsulationBase, Map

Base Class for Encapsulation of a Map.

add_item(key, value: Structure)[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)[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.

rename_key(old_key: str, new_key: str) None[source]
replace_item(key: str, value: Structure) None[source]
property subject: Map

Property for access on encapsulated structure in this EncapsulationBase.

property value

Property for value of this structure.

blackfennec.layers.encapsulation_base.reference_encapsulation_base module

class blackfennec.layers.encapsulation_base.reference_encapsulation_base.ReferenceEncapsulationBase(**kwargs)[source]

Bases: EncapsulationBase

Reference implementation of the EncapsulationBase class.

This class is used to provide a reference implementation of the EncapsulationBase class.

resolve()[source]

Module contents