Base Class

About

FrozenBase is the base class for frozendict and FrozenOrderedDict. If you wish to construct your own frozen dictionary classes, you may wish to inherit from this class.

Usage

API Reference

Base Classes

class cawdrey.base.DictWrapper(*args, **kwds)[source]

Abstract Mixin class for classes that wrap a dict object or similar

__abstractmethods__ = frozenset({'copy'})
__annotations__ = {'_dict': <class 'dict'>}
__args__ = None
__contains__(key)[source]
Return type

Any

__copy__(*args, **kwargs)[source]
__eq__(other)

Return self==value.

__extra__ = None
__getitem__(key)[source]
Return type

Any

__hash__ = None
__iter__()[source]
__len__()[source]
Return type

int

__module__ = 'cawdrey.base'
static __new__(cls, *args, **kwds)

Create and return a new object. See help(type) for accurate signature.

__next_in_mro__

alias of builtins.object

__orig_bases__ = (typing.Mapping[~KT, ~VT],)
__origin__ = None
__parameters__ = (~KT, ~VT)
__repr__()[source]

Return repr(self).

Return type

str

__reversed__ = None
__slots__ = ()
__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__tree_hash__ = -9223366107695461734
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 42
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 42
_abc_registry = <_weakrefset.WeakSet object>
_dict: dict
_gorg

alias of DictWrapper

abstract copy(*args, **kwargs)[source]
get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D’s items
keys() → a set-like object providing a view on D’s keys
values() → an object providing a view on D’s values
class cawdrey.base.FrozenBase(*args, **kwds)[source]

Abstract Base Class for Frozen dictionaries

Used by frozendict and FrozenOrderedDict.

Custom subclasses must implement at a minimum __init__, copy, fromkeys.

__abstractmethods__ = frozenset({'__init__', 'copy'})
__annotations__ = {'dict_cls': typing.Union[typing.Type, NoneType]}
__args__ = None
__contains__(key)
Return type

Any

__copy__(*args, **kwargs)
__eq__(other)

Return self==value.

__extra__ = None
__getitem__(key)
Return type

Any

__hash__ = None
abstract __init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

__iter__()
__len__()
Return type

int

__module__ = 'cawdrey.base'
static __new__(cls, *args, **kwds)

Create and return a new object. See help(type) for accurate signature.

__next_in_mro__

alias of builtins.object

__orig_bases__ = (cawdrey.base.DictWrapper[~KT, ~VT],)
__origin__ = None
__parameters__ = (~KT, ~VT)
__repr__()

Return repr(self).

Return type

str

__reversed__ = None
__slots__ = ()
__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__tree_hash__ = -9223366107695456485
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 42
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 42
_abc_registry = <_weakrefset.WeakSet object>
_gorg

alias of FrozenBase

abstract copy(*args, **kwargs)
dict_cls: Optional[Type] = None
classmethod fromkeys(*args, **kwargs)[source]

Returns a new dict with keys from iterable and values equal to value.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D’s items
keys() → a set-like object providing a view on D’s keys
values() → an object providing a view on D’s values
class cawdrey.base.MutableBase(*args, **kwds)[source]

Abstract Base Class for mutable dictionaries

Used by NonelessDict and NonelessOrderedDict.

Custom subclasses must implement at a minimum __init__, copy, fromkeys.

_MutableMapping__marker = <object object>
__abstractmethods__ = frozenset({'__init__', 'copy'})
__annotations__ = {'_dict': <class 'dict'>}
__args__ = None
__contains__(key)
Return type

Any

__copy__(*args, **kwargs)
__delitem__(key)[source]
__eq__(other)

Return self==value.

__extra__ = None
__getitem__(key)
Return type

Any

__hash__ = None
abstract __init__(*args, **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

__iter__()
__len__()
Return type

int

__module__ = 'cawdrey.base'
static __new__(cls, *args, **kwds)

Create and return a new object. See help(type) for accurate signature.

__next_in_mro__

alias of builtins.object

__orig_bases__ = (cawdrey.base.DictWrapper[~KT, ~VT], typing.MutableMapping[~KT, ~VT])
__origin__ = None
__parameters__ = (~KT, ~VT)
__repr__()

Return repr(self).

Return type

str

__reversed__ = None
__setitem__(key, value)[source]
__slots__ = ()
__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

__tree_hash__ = -9223366107695463175
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache = <_weakrefset.WeakSet object>
_abc_generic_negative_cache_version = 42
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 42
_abc_registry = <_weakrefset.WeakSet object>
_dict
_gorg

alias of MutableBase

clear() → None. Remove all items from D.
abstract copy(*args, **kwargs)
dict_cls = None
classmethod fromkeys(*args, **kwargs)[source]

Returns a new dict with keys from iterable and values equal to value.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
items() → a set-like object providing a view on D’s items
keys() → a set-like object providing a view on D’s keys
pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() → (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) → None. Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() → an object providing a view on D’s values