plato.context module¶
Context management
-
class
plato.context.
Context
(hasher, parent=None, meta=None)[source]¶ Bases:
object
Context used in sampling from
Provider
instances.- Parameters
hasher – Hasher used to derive the random number seed and to derive hashers for subcontexts.
parent (Optional[plato.context.Context]) – The parent context if any.
meta (dict) – A dictionary that can be used by
Provider
instances to store additional information in the context. Be aware that the passed instance might be modified.
-
meta
: dict[source]¶ Dictionary that can be used by providers to store additional information across invocations of
Provider.sample()
. Use theProvider
instance or concrete class as key to avoid key collisions with other providers.
-
parent
: Optional[plato.context.Context][source]¶ The parent context or
None
if this is a root context.
-
rng
: random.Random[source]¶ A seeded random number generator that may be used for the generation of random numbers.
-
class
plato.context.
Hasher
(*args, **kwargs)[source]¶ Bases:
Protocol
Protocol of classes to perform incremental hashing.