atom.scalars

class atom.scalars.Value(default=None, factory=None)[source]

Bases: atom.catom.Member

A member class which supports value initialization.

A plain Value provides support for default values and factories, but does not perform any type checking or validation. It serves as a useful base class for scalar members and can be used for cases where type checking is not needed (like private attributes).

__init__(default=None, factory=None)[source]

Initialize a Value.

Parameters :

default : object, optional

The default value for the member. If this is provided, it should be an immutable value. The value will will not be copied between owner instances.

factory : callable, optional

A callable object which is called with zero arguments and returns a default value for the member. This will override any value given by default.

class atom.scalars.ReadOnly(default=None, factory=None)[source]

Bases: atom.scalars.Value

A value which can be assigned once and is then read-only.

class atom.scalars.Constant(default=None, factory=None)[source]

Bases: atom.scalars.Value

A value which cannot be changed from its default.

class atom.scalars.Callable(default=None, factory=None)[source]

Bases: atom.scalars.Value

A value which is callable.

class atom.scalars.Bool(default=False, factory=None)[source]

Bases: atom.scalars.Value

A value of type bool.

class atom.scalars.Int(default=0, factory=None, strict=True)[source]

Bases: atom.scalars.Value

A value of type int.

By default, ints are strictly typed. Pass strict=False to the constructor to enable int casting for longs and floats.

class atom.scalars.Long(default=0L, factory=None, strict=False)[source]

Bases: atom.scalars.Value

A value of type long.

By default, ints are promoted to longs. Pass strict=True to the constructor to enable strict long checking.

class atom.scalars.Float(default=0.0, factory=None, strict=False)[source]

Bases: atom.scalars.Value

A value of type float.

By default, ints and longs will be promoted to floats. Pass strict=True to the constructor to enable strict float checking.

class atom.scalars.Str(default='', factory=None, strict=False)[source]

Bases: atom.scalars.Value

A value of type str.

By default, unicode strings will be promoted to plain strings. Pass strict=True to the constructor to enable strict string checking.

class atom.scalars.Unicode(default=u'', factory=None, strict=False)[source]

Bases: atom.scalars.Value

A value of type unicode.

By default, plain strings will be promoted to unicode strings. Pass strict=True to the constructor to enable strict unicode checking.

class atom.scalars.Range(low=None, high=None, value=None)[source]

Bases: atom.scalars.Value

An integer value clipped to a range.

class atom.scalars.FloatRange(low=None, high=None, value=None)[source]

Bases: atom.scalars.Value

A float value clipped to a range.