atom.property module

class atom.property.Property(fget=None, fset=None, fdel=None, cached=False)[source]

Bases: atom.catom.Member

A Member which behaves similar to a Python property.

property cached

Test whether or not this is a cached property.

deleter(func)[source]

Use the given function as the property deleter.

This method is intended to be used as a decorator. The original function will still be callable.

property fdel

Get the deleter function for the property.

This will not find a specially named _del_* function.

property fget

Get the getter function for the property.

This will not find a specially named _get_* function.

property fset

Get the setter function for the property.

This will not find a specially named _set_* function.

getter(func)[source]

Use the given function as the property getter.

This method is intended to be used as a decorator. The original function will still be callable.

reset(owner)[source]

Reset the value of the property.

The old property value will be cleared and the notifiers will be run if the new value is different from the old value. If the property is not cached, notifiers will be unconditionally run using None as the old value.

setter(func)[source]

Use the given function as the property setter.

This method is intended to be used as a decorator. The original function will still be callable.

atom.property.cached_property(fget)[source]

A decorator which converts a function into a cached Property.

Parameters

fget (callable) – The callable invoked to get the property value. It must accept a single argument which is the owner object.