astropy 5.0

BackRef

You can replace its functionality with a combination of the __init_subclass__ and __set_name__ magic methods introduced in Python 3.6. See https://github.com/astropy/astropy/issues/11094 for recipes on how to replicate their functionality.

Base class for descriptors whose order in the class body should be preserved. Intended for use in concert with the OrderedDescriptorContainer metaclass.

Subclasses of OrderedDescriptor must define a value for a class attribute called _class_attribute_ . This is the name of a class attribute on the container class for these descriptors, which will be set to an OrderedDict at class creation time. This OrderedDict will contain a mapping of all class attributes that were assigned instances of the OrderedDescriptor subclass, to the instances themselves. See the documentation for OrderedDescriptorContainer for a concrete example.

Optionally, subclasses of OrderedDescriptor may define a value for a class attribute called _name_attribute_ . This should be the name of an attribute on instances of the subclass. When specified, during creation of a class containing these descriptors, the name attribute on each instance will be set to the name of the class attribute it was assigned to on the class.

note

Although this class is intended for use with descriptors (i.e. classes that define any of the __get__ , __set__ , or __delete__ magic methods), this base class is not itself a descriptor, and technically this could be used for classes that are not descriptors too. However, use with descriptors is the original intended purpose.

deprecated

The OrderedDescriptor class is deprecated and may be removed in a future version.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

astropy.utils.misc.OrderedDescriptor.__lt__ astropy.utils.misc.OrderedDescriptor

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /astropy/utils/misc.py#512
type: <class 'abc.ABCMeta'>
Commit: