pkgcore.restrictions.restriction module

base restriction class

class pkgcore.restrictions.restriction.AlwaysBool(*a, **kw)[source]

Bases: base

restriction that always yields a specific boolean

force_False(*a, **kw)[source]
force_True(*a, **kw)[source]
match(*a, **kw)[source]
negate
type
class pkgcore.restrictions.restriction.AnyMatch(*a, **kw)[source]

Bases: base

Apply a nested restriction to every item in a sequence.

match(val)[source]
negate
restriction
type
class pkgcore.restrictions.restriction.FakeType(*a, **kw)[source]

Bases: base

wrapper to wrap and fake a node_type

match(*a, **kw)[source]
type
class pkgcore.restrictions.restriction.Negate(*a, **kw)[source]

Bases: base

wrap and negate a restriction instance

match(*a, **kw)[source]
type
class pkgcore.restrictions.restriction.base(*a, **kw)[source]

Bases: SlotsPicklingMixin

base restriction matching object.

all derivatives should be __slots__ based (lot of instances may wind up in memory).

force_False(*arg, **kwargs)[source]
force_True(*arg, **kwargs)[source]
match(*arg, **kwargs)[source]
package_matching = False
pkgcore.restrictions.restriction.curry_node_type(cls, node_type, extradoc=None)[source]

Helper function for creating restrictions of a certain type.

This uses partial to 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.