Subpackage accretive.concealment

Module accretive.concealment

Accretive data structures with attributes concealment.

Accretive data structures can grow at any time but can never shrink. An accretive dictionary accepts new entires, but cannot have existing entries altered or removed. Similarly, an accretive namespace accepts new attributes, but cannot have existing attributes assigned to new values or deleted.

Data structures, provided by this subpackage, have concealed attributes. Concealed attributes do not appear in listings via the dir() builtin function. By default, only attributes names, which do not start with _ are made visible, but additional attributes can be included if they are listed on a particular class attribute that the concealer honors.

class accretive.concealment.ABCFactory(name: str, bases: Tuple[type, ...], namespace: MutableMapping[str, Any], docstring: str | None = None, **nomargs: Any)

Bases: ClassConcealerExtension, ABCFactory

Accretive abstract base classes (ABC).

Derived from type, this is a metaclass. A metaclass is a class factory class. I.e., it is a class that produces other classes as its instances.

Prevents reassignment or deletion of class attributes after they have been assigned. Only assignment of new class attributes is permitted.

Derived from and compatible with abc.ABCMeta. The __abstractmethods__ class attribute and the class attributes, whose names start with _abc_, are exempt from the accretion mechanism so that the internal method abstraction machinery can function correctly.

By default, all class attributes, whose names do not start with _, are returned from an invocation of dir(). Additional class attributes can be returned, if the _class_attribute_visibility_includes_ attribute is provided on a subclass.

mro()

Return a type’s method resolution order.

register(subclass)

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

class accretive.concealment.Class(name: str, bases: Tuple[type, ...], namespace: MutableMapping[str, Any], docstring: str | None = None, **nomargs: Any)

Bases: ClassConcealerExtension, Class

Accretive classes.

Derived from type, this is a metaclass. A metaclass is a class factory class. I.e., it is a class that produces other classes as its instances.

Prevents reassignment or deletion of class attributes after they have been assigned. Only assignment of new class attributes is permitted.

By default, all class attributes, whose names do not start with _, are returned from an invocation of dir(). Additional class attributes can be returned, if the _class_attribute_visibility_includes_ attribute is provided on a subclass.

mro()

Return a type’s method resolution order.

class accretive.concealment.Dictionary(*iterables: Mapping[Hashable, typing_extensions.Any] | Iterable[Tuple[Hashable, typing_extensions.Any]][Mapping[Hashable, Any] | Iterable[Tuple[Hashable, Any]]], **entries: Any[Any])

Bases: ConcealerExtension, Dictionary

Accretive dictionary.

Prevents alteration or removal of dictionary entries after they have been added. Only addition of new dictionary entries is permitted.

Prevents reassignment or deletion of instance attributes after they have been assigned. Only assignment of new instance attributes is permitted.

By default, all instance attributes, whose names do not start with _, are returned from an invocation of dir(). Additional instance attributes can be returned, if the _attribute_visibility_includes_ attribute is provided on a subclass.

copy() Self

Provides fresh copy of dictionary.

get(key: ~typing.Hashable, default: ~typing_extensions.Any = <object object>) Any[Any]

Retrieves entry associated with key, if it exists.

items() ItemsView[Hashable, Any]

Provides iterable view over dictionary items.

keys() KeysView[Hashable]

Provides iterable view over dictionary keys.

update(*iterables: Mapping[Hashable, typing_extensions.Any] | Iterable[Tuple[Hashable, typing_extensions.Any]][Mapping[Hashable, Any] | Iterable[Tuple[Hashable, Any]]], **entries: Any[Any]) Self

Adds new entries as a batch.

values() ValuesView[Any]

Provides iterable view over dictionary values.

class accretive.concealment.Module(name, doc=None)

Bases: ConcealerExtension, Module

Accretive modules.

Derived from types.ModuleType, this class is suitable for use as a Python module class.

Prevents reassignment or deletion of module attributes after they have been assigned. Only assignment of new module attributes is permitted.

By default, all module attributes, whose names do not start with _, are returned from an invocation of dir(). Additional module attributes can be returned, if the _attribute_visibility_includes_ attribute is provided on a subclass.

class accretive.concealment.Namespace(*iterables: Mapping[Hashable, typing_extensions.Any] | Iterable[Tuple[Hashable, typing_extensions.Any]][Mapping[Hashable, Any] | Iterable[Tuple[Hashable, Any]]], **attributes: Any[Any])

Bases: ConcealerExtension, Namespace

Accretive namespaces.

A namespace is an object, whose attributes can be determined from iterables and keyword arguments, at initialization time. The string representation of the namespace object reflects its current instance attributes. Modeled after types.SimpleNamespace.

Prevents reassignment or deletion of instance attributes after they have been assigned. Only assignment of new instance attributes is permitted.

By default, all instance attributes, whose names do not start with _, are returned from an invocation of dir(). Additional instance attributes can be returned, if the _attribute_visibility_includes_ attribute is provided on a subclass.

class accretive.concealment.Object(*posargs: Any, **nomargs: Any)

Bases: ConcealerExtension, Object

Accretive objects.

Prevents reassignment or deletion of instance attributes after they have been assigned. Only assignment of new instance attributes is permitted.

By default, all instance attributes, whose names do not start with _, are returned from an invocation of dir(). Additional instance attributes can be returned, if the _attribute_visibility_includes_ attribute is provided on a subclass.

class accretive.concealment.ProducerDictionary(producer: Callable[[], typing_extensions.Any][Callable[[], Any]], /, *iterables: Mapping[Hashable, typing_extensions.Any] | Iterable[Tuple[Hashable, typing_extensions.Any]][Mapping[Hashable, Any] | Iterable[Tuple[Hashable, Any]]], **entries: Any[Any])

Bases: ConcealerExtension, ProducerDictionary

Accretive dictionary with default value for missing entries.

Prevents alteration or removal of dictionary entries after they have been added. Only addition of new dictionary entries is permitted.

When an attempt to access a missing entry is made, then the entry is added with a default value. Modeled after collections.defaultdict.

Prevents reassignment or deletion of instance attributes after they have been assigned. Only assignment of new instance attributes is permitted.

By default, all instance attributes, whose names do not start with _, are returned from an invocation of dir(). Additional instance attributes can be returned, if the _attribute_visibility_includes_ attribute is provided on a subclass.

copy() Self

Provides fresh copy of dictionary.

get(key: ~typing.Hashable, default: ~typing_extensions.Any = <object object>) Any[Any]

Retrieves entry associated with key, if it exists.

items() ItemsView[Hashable, Any]

Provides iterable view over dictionary items.

keys() KeysView[Hashable]

Provides iterable view over dictionary keys.

update(*iterables: Mapping[Hashable, typing_extensions.Any] | Iterable[Tuple[Hashable, typing_extensions.Any]][Mapping[Hashable, Any] | Iterable[Tuple[Hashable, Any]]], **entries: Any[Any]) Self

Adds new entries as a batch.

values() ValuesView[Any]

Provides iterable view over dictionary values.

accretive.concealment.reclassify_modules(attributes: ~typing.Mapping[str, ~typing_extensions.Any], *, to_class: ~typing.Type[module] = <class 'accretive.concealment.modules.Module'>) None

Reclassifies modules in dictionary with custom module type.

Module accretive.concealment.aaliases

Abbreviated aliases to accretive data structures.

Similar to Python builtins.

accretive.concealment.aaliases.acabcmeta

alias of ABCFactory

accretive.concealment.aaliases.acdefaultdict

alias of ProducerDictionary

accretive.concealment.aaliases.acdict

alias of Dictionary

accretive.concealment.aaliases.acmodule

alias of Module

accretive.concealment.aaliases.acnamespace

alias of Namespace

accretive.concealment.aaliases.acobject

alias of Object

accretive.concealment.aaliases.actype

alias of Class

Module accretive.concealment.qaliases

Qualified aliases to accretive data structures.

Useful for avoiding namespace collisions from attribute imports.

accretive.concealment.qaliases.AccretiveABCFactory

alias of ABCFactory

accretive.concealment.qaliases.AccretiveClass

alias of Class

accretive.concealment.qaliases.AccretiveDictionary

alias of Dictionary

accretive.concealment.qaliases.AccretiveModule

alias of Module

accretive.concealment.qaliases.AccretiveNamespace

alias of Namespace

accretive.concealment.qaliases.AccretiveObject

alias of Object

accretive.concealment.qaliases.AccretiveProducerDictionary

alias of ProducerDictionary