pkgcore.restrictions.restriction module¶
base restriction class
- class pkgcore.restrictions.restriction.AlwaysBool(*args: Hashable, disable_inst_caching=False, **kwargs: Hashable)[source]¶
Bases:
baserestriction that always yields a specific boolean
- type: T_restriction¶
- class pkgcore.restrictions.restriction.AnyMatch(*args: Hashable, disable_inst_caching=False, **kwargs: Hashable)[source]¶
Bases:
baseApply a nested restriction to every item in a sequence.
- negate¶
- restriction¶
- type: T_restriction¶
- class pkgcore.restrictions.restriction.FakeType(*args: Hashable, disable_inst_caching=False, **kwargs: Hashable)[source]¶
Bases:
basewrapper to wrap and fake a node_type
- type: T_restriction¶
- class pkgcore.restrictions.restriction.Negate(*args: Hashable, disable_inst_caching=False, **kwargs: Hashable)[source]¶
Bases:
basewrap and negate a restriction instance
- type: T_restriction¶
- class pkgcore.restrictions.restriction.base(*args: Hashable, disable_inst_caching=False, **kwargs: Hashable)[source]¶
Bases:
SlotsPicklingMixin,Simple,WeaklyCachedABCbase restriction matching object.
all derivatives should be __slots__ based (lot of instances may wind up in memory).
- type: T_restriction¶
- pkgcore.restrictions.restriction.curry_node_type(cls, node_type: T_restriction, extradoc=None)[source]¶
Helper function for creating restrictions of a certain type.
This uses
functools.partialto pass a node_type to the wrapped class, and extends the docstring.- Parameters:
cls – callable (usually a class) that is wrapped.
node_type – value passed as node_type.
extradoc – addition to the docstring. Defaults to “Automatically set to %s type.” % node_type
- Returns:
a wrapped callable.