pyre.schemata

Package Contents

class pyre.schemata.identity(default=None, **kwds)

The base class for type declarators

typename = identity
coerce(self, value, **kwds)

Convert the given value into a python native object

string(self, value)

Render value as a string that can be persisted for later coercion

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.bool(default=True, **kwds)

Bases: pyre.schemata.Numeric.Numeric

A type declarator for booleans

typename = bool
complaint = could not coerce {0.value!r} to bool
xlat
coerce(self, value, **kwds)

Convert {value} into a boolean

class pyre.schemata.complex(default=complex(), **kwds)

Bases: pyre.schemata.Numeric.Numeric

A type declarator for complex numbers

typename = complex
complaint = could not coerce {0.value!r} into a complex number
coerce(self, value, **kwds)

Attempt to convert {value} into a complex number

class pyre.schemata.decimal(default=decimal.Decimal(), **kwds)

Bases: pyre.schemata.Numeric.Numeric

A type declarator for fixed point numbers

typename = decimal
coerce(self, value, **kwds)

Attempt to convert {value} into a decimal

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.float(default=float(), **kwds)

Bases: pyre.schemata.Numeric.Numeric

A type declarator for floats

typename = float
complaint = could not coerce {0.value!r} into a float
coerce(self, value, **kwds)

Attempt to convert {value} into a float

class pyre.schemata.fraction(default=fractions.Fraction(), **kwds)

Bases: pyre.schemata.Numeric.Numeric

A type declarator for fixed point numbers

typename = fraction
ncomplaint = could not coerce {0.value!r) into a fraction
coerce(self, value, **kwds)

Attempt to convert {value} into a fraction

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.inet(default=any, **kwds)

Bases: pyre.schemata.Schema.Schema

A type declarator for internet addresses

address
any
typename = inet
complaint = could not coerce {0.value!r} into an internet address
regex
coerce(self, value, **kwds)

Attempt to convert {value} into a internet address

recognize(self, family, address)

Return an appropriate address type based on the socket family

parse(self, value)

Convert {value}, expected to be a string, into an inet address

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.int(default=int(), **kwds)

Bases: pyre.schemata.Numeric.Numeric

A type declarator for integers

typename = int
complaint = could not coerce {0.value!r} into an integer
coerce(self, value, **kwds)

Attempt to convert {value} into an integer

class pyre.schemata.str(default=str(), **kwds)

Bases: pyre.schemata.Schema.Schema

A type declarator for strings

typename = str
complaint = could not coerce {0.value!r} into a string
coerce(self, value, **kwds)

Attempt to convert {value} into a string

class pyre.schemata.date(default=datetime.date.today(), format=format, **kwds)

Bases: pyre.schemata.Schema.Schema

A type declarator for dates

format = %Y-%m-%d
typename = date
coerce(self, value, **kwds)

Attempt to convert {value} into a date

string(self, value)

Render value as a string that can be persisted for later coercion

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.dimensional(default=units.zero, **kwds)

Bases: pyre.schemata.Numeric.Numeric

A type declarator for quantities with units

typename = dimensional
complaint = could not coerce {0.value!r} into a dimensional quantity
parser
coerce(self, value, **kwds)

Attempt to convert {value} into a dimensional

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.path

Bases: pyre.schemata.Schema.Schema

A type declarator for paths

typename = path
complaint = cannot cast {0.value!r} into a path
cwd
root
home
coerce(self, value, **kwds)

Attempt to convert {value} into a path

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.time(default=datetime.datetime.today(), format=format, **kwds)

Bases: pyre.schemata.Schema.Schema

A type declarator for timestamps

format = %H:%M:%S
typename = time
complaint = could not coerce {0.value!r} into a time
coerce(self, value, **kwds)

Attempt to convert {value} into a timestamp

string(self, value)

Render value as a string that can be persisted for later coercion

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.timestamp(default=datetime.datetime.today(), format=format, **kwds)

Bases: pyre.schemata.Schema.Schema

A type declarator for timestamps

format = %Y-%m-%d %H:%M:%S
typename = timestamp
complaint = could not coerce {0.value!r} into a time
coerce(self, value, **kwds)

Attempt to convert {value} into a timestamp

string(self, value)

Render value as a string that can be persisted for later coercion

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.uri(default=locator(), scheme=None, authority=None, address=None, **kwds)

Bases: pyre.schemata.Schema.Schema

Parser for resource identifiers

typename = uri
complaint = could not coerce {0.value!r} into a URI
coerce(self, value, **kwds)

Attempt to convert {value} into a resource locator

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.sequence

Bases: pyre.schemata.Container.Container

The base class for type declarators that are sequences of other types

open = [({
close = ])}
delimiter = ,
typename = sequence
container
complaint = could not coerce {0.value!r} as a sequence
str(self, value)

Render value as a string that can be persisted for later coercion

json(self, value)

Generate a JSON representation of {value}

_coerce(self, value, incognito=True, **kwds)

Convert {value} into an iterable

class pyre.schemata.array(default=(), **kwds)

Bases: pyre.schemata.Schema.Schema

The array type declarator

typename = array
complaint = could not coerce {0.value!r} to an array
coerce(self, value, **kwds)

Convert {value} into a tuple

class pyre.schemata.list

Bases: pyre.schemata.Sequence.Sequence

The list type declarator

typename = list
container
class pyre.schemata.set

Bases: pyre.schemata.Sequence.Sequence

The set type declarator

typename = set
container
json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.tuple

Bases: pyre.schemata.Sequence.Sequence

The tuple type declarator

typename = tuple
container
class pyre.schemata.mapping

Bases: pyre.schemata.Container.Container

The base class for type declarators that map strings to other types

typename = mapping
container
complaint = could not coerce {0.value!r} to a mapping
_coerce(self, value, **kwds)

Convert {value} into a container

class pyre.schemata.catalog

Bases: pyre.schemata.Mapping.Mapping

The catalog type declarator

typename = catalog
class pyre.schemata.component(protocol, default=default, **kwds)

Bases: pyre.schemata.Schema.Schema

A type declarator for components

default
complaint = could not coerce {0.value!r} into a component
protocol
coerce(self, value, **kwds)

Attempt to convert {value} into a component class compatible with my protocol

string(self, value)

Render value as a string that can be persisted for later coercion

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.istream(default='stdin', mode=mode, **kwds)

Bases: pyre.schemata.Schema.Schema, pyre.framework.Dashboard.Dashboard

A representation of input streams

mode = r
typename = istream
coerce(self, value, **kwds)

Attempt to convert {value} into an open input stream

string(self, value)

Render value as a string that can be persisted for later coercion

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.ostream(default='stdout', mode=mode, **kwds)

Bases: pyre.schemata.Schema.Schema, pyre.framework.Dashboard.Dashboard

A representation of input streams

mode = w
typename = ostream
coerce(self, value, **kwds)

Attempt to convert {value} into an open input stream

string(self, value)

Render value as a string that can be persisted for later coercion

json(self, value)

Generate a JSON representation of {value}

class pyre.schemata.envvar(variable, **kwds)

Bases: pyre.schemata.String.String

A type declarator for strings whose default values are associated with an environment variable

typename = envvar
class pyre.schemata.envpath(variable, pathsep=pathsep, **kwds)

Bases: pyre.schemata.List.List

A list of paths whose default value is tied to the value of an environment variable

typename = envpath
pathsep
_coerce(self, value, **kwds)

Convert {value} into an iterable

pyre.schemata.basic
pyre.schemata.composite
pyre.schemata.containers
pyre.schemata.meta
pyre.schemata.schemata
pyre.schemata.sequences
pyre.schemata.mappings
pyre.schemata.numeric
class pyre.schemata.typed(schemata=schemata, **kwds)

A class decorator that embeds type decorated subclasses whose names match their {typename}

__call__(self, client)

Build a class record