core4685%python.module
fault.time

Defines the time Context that constructs unit types and manages their relationships to other unit types.

collections
import

fractions0
import

functools0
import

operator0
import

builtins0
import

Type
import

Sequence0
import

abstract0
import

kinds0
data

kinds = (
	'definite',
	'indefinite',
	'subjective',
)

unix_epoch_delta0
data

unix_epoch_delta = (((((2000-1970) * 365) + 7) * (24*60*60)) + (24*60*60))

Exception0
class

Generic time exception.

TransformException0
class

An attempt to transform units failed.

TransformExceptionunit_input
data

unit_input = None

TransformExceptionunit_output
data

unit_output = None

TransformExceptioncontext
data

context = None

TransformException__init__0
method

__init__(self, *args)

Inconceivable0
class

An attempt to represent a unit in like-terms was not possible given the current implementation.

Usually raised when a finite term attempts to convert an indefinite term or an ambiguous term.

FormatError0
class

ParseError0
class

The exception raised when a string representation of the datetime could not be parsed.

ParseError__init__0
method

__init__(self, source)

ParseError__str__10%
method

__str__(self)

StructureError0
class

The exception raised when the structure of a parsed format could not be transformed.

StructureError__init__0
method

__init__(self, source, struct)

StructureError__str__10%
method

__str__(self)

IntegrityError0
class

The exception raised when a parsed point in time is not consistent.

Notably, in the RFC format, there are portions specifying intersecting parts of a timestamp. (The day of week field is arguably superfluous.)

IntegrityError__init__0
method

__init__(self, source, struct, tuple)

IntegrityError__str__10%
method

__str__(self)

Unit0
class

The base class for finite abstract.Measure and abstract.Point subclasses across all Context instances.

Unit__slots__0
data

__slots__ = ()
	@classmethod

Unitconstruct197%
classmethod

construct(Class, units, parts)

Unitof0
classmethod

of(Class, *units, **parts)

Unitupdate0
method

update(self)

Unittruncate0
method

truncate(self, unit)

Unitselect0
method

select(self, part)

Measure
class

Measure__slots__0
data

__slots__ = ()
	@property

Measurestart0
property

Measurestop10%
property

Measure__neg__10%
method

__neg__(self)

Measure__abs__10%
method

__abs__(self)

Measure__str__0
method

__str__(self)

Measure__repr__140%
method

__repr__(self)

Measure__contains__10%
method

__contains__(self, t)

Measureelapse10%
method

elapse(self, *args, **parts)

Measureadjust0
data

adjust = elapse

Measureincrease10%
method

increase(self, *units, **parts)

Measuredecrease0
method

decrease(self, *units, **parts)

Point
class

Point__slots__0
data

__slots__ = ()
	@property

Pointstart10%
property

Pointstop10%
property

Point__contains__0
method

__contains__(self, t)

Point__str__10%
method

__str__(self)

Point__repr__10%
method

__repr__(self)

Pointrollback0
method

rollback(self, *units, **parts)

Pointelapse0
method

elapse(self, *units, **parts)

Pointmeasure0
method

measure(self, pit)

Pointleads466%
method

leads(self, pit)

Pointprecedes0
data

precedes = leads

Pointfollows283%
method

follows(self, pit)

Pointproceeds0
data

proceeds = follows

Context0
class

A container for time units and transformations.

Context__init__0
method

__init__(self)

Contextdeclare188%
method

declare(self, id, datum)

Declare a fundamental unit for use in a context.

All defined, Context.define, units are defined in terms of a declared unit.

Contextdefine183%
method

define(self, id, term, exponent)

Defines a Unit in terms of another unit.

Contextbridge0
method

bridge(self, from_unit, to_unit, transformer)

Assign a "bridge" between two units.

In the case where a unit cannot not be resolved from its definitions, bridges can be used to perform the conversion.

Contextcontainer166%
method

container(self, id, pack, unpack)

Contextconstant0
method

constant(self, id, value)

Contextcompose0
method

compose(self, from_unit, to_unit)

Compose two ratios into another so that the from_unit can be converted into the to_unit.

Ratio compositions are LRU cached.

Contextconvert284%
method

convert(self, from_unit, to_unit, value)

Convert the value into to_unit from the from_unit.

Contextregister_point_class0
method

register_point_class(self, Point)

Contextregister_measure_class0
method

register_measure_class(self, Measure)

Contextnew_measure_class0
method

new_measure_class(self, id)

Contextnew_point_class0
method

new_point_class(self, Measure)

Contextdatum_for_point180%
method

datum_for_point(self, to_unit)

Contextpoint_from_unit40%
method

point_from_unit(self, unit)

Contextmeasure_from_unit0
method

measure_from_unit(self, unit)

Contextrepresent0
method

represent(self, term, unitseq)

Contextpoint_factory0
method
Type[abstract.Point]

point_factory(self, Measure, qname)

Construct a Point class from the given scalar.

Contextmeasure_factory0
method
Type[abstract.Measure]

measure_factory(self, id, qname)

Construct a measure with the designated unit identifier and class.

standard_context294%
function
tuple[Context, Sequence[abstract.Measure], Sequence[abstract.Point]]

standard_context(qname)

Construct the standard time context from the local modules.

Normally called by types during import to initialize the primary data types.