Type

class typerighter.types.base.Type(*a, **kw)[source]

This class represents the top, and thus most ambiguous, point of the Typerighter hierarchy.

It’s purpose is to define the baseline expectations for every other Type in this library.

NATIVE

alias of builtins.object

is_coercible(value)[source]

Checks a value for whether or not it can be converted to the correct type. Falls back to the stricter is_type_match if self.strict is True.

Parameters

value (object) – The value to inspect

is_falsy(value)[source]

Checks a value and responds saying whether the Type considers it falsy.

Parameters

value (object) – The value to inspect

Returns

True or False

is_type_match(value)[source]

Checks if a value is an instance of this Type’s native type. :param object value: The value to inspect

to_native(value)[source]

Converts a value to the native form of this type

Parameters

value (object) – The value to convert

to_primitive(value)[source]

Converts a value to the primitive form of this type

Parameters

value (object) – The value to convert

to_schematic()[source]

Returns a Type’s Schematic

validate(value)[source]

This validation function is the primary function responsible for calling all associated validators and for managing any details related to aggregation of validation results.

Parameters

value (object) – The value to convert

class typerighter.types.base.UnsetValue[source]

This class exists to put a label on the type of value that represents when a field does not _yet_ have a value.

typerighter.types.base.skip_falsy(method)[source]

A decorator that intercepts method calls to prevent falsy inputs from being validated unnecessarily.