atom.instance module

class atom.instance.ForwardInstance(resolve, args=None, kwargs=None, *, factory=None, optional=True)[source]

Bases: atom.instance.Instance

An Instance which delays resolving the type definition.

The first time the value is accessed or modified, the type will be resolved and the forward instance will behave identically to a normal instance.

args
clone()[source]

Create a clone of the ForwardInstance object.

default(owner)[source]

Called to retrieve the default value.

This is called the first time the default value is retrieved for the member. It resolves the type and updates the internal default handler to behave like a normal Instance member.

kwargs
optional
resolve
validate(owner, old, new)[source]

Called to validate the value.

This is called the first time a value is validated for the member. It resolves the type and updates the internal validate handler to behave like a normal Instance member.

class atom.instance.Instance(kind, args=None, kwargs=None, *, factory=None, optional=True)[source]

Bases: atom.catom.Member

A value which allows objects of a given type or types.

Values will be tested using the PyObject_IsInstance C API call. This call is equivalent to isinstance(value, kind) and all the same rules apply.

If optional is True, the value of an Instance may be set to None, otherwise None is not considered as a valid value.