wtypes.combining_types
¶
Module Contents¶
-
class
wtypes.combining_types.
_NotType
¶ Bases:
wtypes.base._ConstType
-
validate
(cls, object)¶
-
__getitem__
(cls, object)¶
-
-
class
wtypes.combining_types.
Not
¶ Bases:
wtypes.base.Trait
not schema.
Examples
>>> assert Not[wtypes.String](100) == 100 >>> assert not isinstance('abc', Not[wtypes.String])
Note
See the __neg__ method for symbollic not composition.
-
class
wtypes.combining_types.
_AnyOfType
¶ Bases:
wtypes.base._ConstType
-
validate
(cls, object)¶
-
__getitem__
(cls, object)¶
-
-
class
wtypes.combining_types.
AnyOf
¶ Bases:
wtypes.base.Trait
anyOf combined schema.
Examples
>>> assert AnyOf[wtypes.Integer, wtypes.String]('abc') >>> assert isinstance(10, AnyOf[wtypes.Integer, wtypes.String]) >>> assert not isinstance([], AnyOf[wtypes.Integer, wtypes.String])
-
class
wtypes.combining_types.
_AllOfType
¶ Bases:
wtypes.base._ConstType
-
validate
(cls, object)¶
-
__getitem__
(cls, object)¶
-
-
class
wtypes.combining_types.
AllOf
¶ Bases:
wtypes.base.Trait
allOf combined schema.
Examples
>>> assert AllOf[wtypes.Float>0, wtypes.Integer/3](9) >>> assert isinstance(9, AllOf[wtypes.Float>0, wtypes.Integer/3]) >>> assert not isinstance(-9, AllOf[wtypes.Float>0, wtypes.Integer/3])
-
class
wtypes.combining_types.
_OneOfType
¶ Bases:
wtypes.base._ConstType
-
validate
(cls, object)¶
-
__getitem__
(cls, object)¶
-
-
class
wtypes.combining_types.
OneOf
¶ Bases:
wtypes.base.Trait
oneOf combined schema.
Examples
>>> assert OneOf[wtypes.Float>0, wtypes.Integer/3](-9) >>> assert isinstance(-9, OneOf[wtypes.Float>0, wtypes.Integer/3]) >>> assert not isinstance(9, OneOf[wtypes.Float>0, wtypes.Integer/3])