How to use the foolscap.constraint.Any function in foolscap

To help you get started, we’ve selected a few foolscap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github warner / foolscap / src / foolscap / schema.py View on Github external
from foolscap.tokens import Violation, UnknownSchemaType, BananaError, \
     tokenNames

# make constraints available in a single location
from foolscap.constraint import Constraint, Any, ByteStringConstraint, \
     IntegerConstraint, NumberConstraint, IConstraint, Optional, Shared
from foolscap.slicers.unicode import UnicodeConstraint
from foolscap.slicers.bool import BooleanConstraint
from foolscap.slicers.dict import DictConstraint
from foolscap.slicers.list import ListConstraint
from foolscap.slicers.set import SetConstraint
from foolscap.slicers.tuple import TupleConstraint
from foolscap.slicers.none import Nothing
#  we don't import RemoteMethodSchema from remoteinterface.py, because
#  remoteinterface.py needs to import us (for addToConstraintTypeMap)
ignored = [Constraint, Any, ByteStringConstraint, UnicodeConstraint,
           IntegerConstraint, NumberConstraint, BooleanConstraint,
           DictConstraint, ListConstraint, SetConstraint, TupleConstraint,
           Nothing, Optional, Shared,
           ] # hush pyflakes

# convenience shortcuts

TupleOf = TupleConstraint
ListOf = ListConstraint
DictOf = DictConstraint
SetOf = SetConstraint


# note: using PolyConstraint (aka ChoiceOf) for inbound tasting is probably
# not fully vetted. One of the issues would be with something like
# ListOf(ChoiceOf(TupleOf(stuff), SetOf(stuff))). The ListUnslicer, when
github warner / foolscap / src / foolscap / remoteinterface.py View on Github external
def getKeywordArgConstraint(self, argname, num_posargs=0,
                                previous_kwargs=[]):
        return (True, Any())
    def checkAllArgs(self, args, kwargs, inbound):
github warner / foolscap / src / foolscap / slicers / list.py View on Github external
def setConstraint(self, constraint):
        if isinstance(constraint, Any):
            return
        assert isinstance(constraint, ListConstraint)
        self.maxLength = constraint.maxLength
        self.itemConstraint = constraint.constraint
github warner / foolscap / src / foolscap / slicers / decimal_slicer.py View on Github external
def setConstraint(self, constraint):
        if isinstance(constraint, Any):
            return
        assert False, "DecimalUnslicer does not currently accept a constraint"
github warner / foolscap / src / foolscap / slicers / bool.py View on Github external
def setConstraint(self, constraint):
        if isinstance(constraint, Any):
            return
        assert isinstance(constraint, BooleanConstraint)
        self.constraint = constraint
github warner / foolscap / src / foolscap / slicers / unicode.py View on Github external
def setConstraint(self, constraint):
        if isinstance(constraint, Any):
            return
        assert isinstance(constraint, UnicodeConstraint)
        self.constraint = constraint
github warner / foolscap / src / foolscap / slicers / vocab.py View on Github external
def setConstraint(self, constraint):
        if isinstance(constraint, Any):
            return
        assert isinstance(constraint, ByteStringConstraint)
        self.valueConstraint = constraint
github warner / foolscap / src / foolscap / slicers / set.py View on Github external
def setConstraint(self, constraint):
        if isinstance(constraint, Any):
            return
        assert isinstance(constraint, SetConstraint)
        self.maxLength = constraint.maxLength
        self.itemConstraint = constraint.constraint
github warner / foolscap / src / foolscap / broker.py View on Github external
def getReferenceByName(name=bytes):
        """If I have published an object by that name, return a reference to
        it."""
        # return Remote(interface=any)
        return Any()
    def decref(clid=int, count=int):
github warner / foolscap / src / foolscap / remoteinterface.py View on Github external
def getPositionalArgConstraint(self, argnum):
        return (True, Any())
    def getKeywordArgConstraint(self, argname, num_posargs=0,