\ :py:mod:`clipppy.stochastic.capsule` ====================================== .. py:module:: clipppy.stochastic.capsule Module Contents --------------- .. py:class:: AllEncapsulator(obj, /, *args, **kwargs) Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default .. py:attribute:: __slots__ :annotation: = ['capsule', 'capsule_args', 'capsule_kwargs'] .. py:method:: __call__(self, *args, **kwargs) .. py:method:: _init__(self, obj, capsule: Optional[Capsule], /, *capsule_args: Capsule, **capsule_kwargs: Capsule) .. py:class:: Capsule(lifetime: numbers.Real = 1) Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default .. py:attribute:: __slots__ :annotation: = ['_value', 'lifetime', 'remaining'] .. py:attribute:: _value :annotation: :Union[weakref.ReferenceType[clipppy.stochastic.wrapper._T], clipppy.stochastic.wrapper._T] .. py:method:: __call__(self) .. py:method:: __repr__(self) Return repr(self). .. py:method:: init(cls, value, lifetime: numbers.Real = 1) :classmethod: .. py:method:: value(self) -> clipppy.stochastic.wrapper._T :property: .. py:class:: Encapsulator(obj, /, *args, **kwargs) Abstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default .. py:method:: _init__(self, obj, /, *capsule_args: Capsule, **capsule_kwargs: Capsule)