2121from astropy .utils .decorators import lazyproperty , format_doc
2222from astropy .utils .exceptions import AstropyWarning , AstropyDeprecationWarning
2323from astropy import units as u
24- from astropy .utils import (OrderedDescriptorContainer , ShapedLikeNDArray ,
25- check_broadcast )
24+ from astropy .utils import ShapedLikeNDArray , check_broadcast
2625from .transformations import TransformGraph
2726from . import representation as r
2827from .angles import Angle
@@ -197,13 +196,12 @@ def __new__(cls, reprname, framename, defaultunit='recommended'):
197196# TODO: This is only needed so that BaseCoordinateFrame can have
198197# OrderedDescriptorContainer as a metaclass. Trying to use
199198# metaclass=OrderedDescriptorContainer directly causes a metaclass conflict.
200- class FrameMeta (OrderedDescriptorContainer , abc .ABCMeta ):
199+ class FrameMeta (abc .ABCMeta ):
201200 pass
202201
203202
204203@format_doc (base_doc , components = _components , footer = "" )
205- class BaseCoordinateFrame (ShapedLikeNDArray ,
206- metaclass = FrameMeta ):
204+ class BaseCoordinateFrame (ShapedLikeNDArray ):
207205 """
208206 The base class for coordinate frames.
209207
@@ -251,8 +249,6 @@ class BaseCoordinateFrame(ShapedLikeNDArray,
251249 # attributes.
252250 frame_specific_representation_info = {}
253251
254- _inherit_descriptors_ = (Attribute ,)
255-
256252 frame_attributes = {}
257253 # Default empty frame_attributes dict
258254
@@ -262,6 +258,7 @@ def __init_subclass__(cls, **kwargs):
262258 default_repr = getattr (cls , 'default_representation' , None )
263259 default_diff = getattr (cls , 'default_differential' , None )
264260 repr_info = getattr (cls , 'frame_specific_representation_info' , None )
261+ frame_attrs = getattr (cls , 'frame_attributes' , None )
265262
266263 # Then, to make sure this works for subclasses-of-subclasses, we also
267264 # have to check for cases where the attribute names have already been
@@ -286,6 +283,19 @@ def __init_subclass__(cls, **kwargs):
286283 cls ._create_readonly_property ('frame_specific_representation_info' ,
287284 copy .deepcopy (repr_info ))
288285
286+ # Set the frame attributes
287+ # TODO: Should this be made to use readonly_prop_factory as well or
288+ # would it be inconvenient for getting the frame_attributes from
289+ # classes?
290+ if frame_attrs is None :
291+ frame_attrs = {}
292+ else :
293+ frame_attrs = frame_attrs .copy ()
294+
295+ frame_attrs .update ({k : v for k , v in cls .__dict__ .items ()
296+ if isinstance (v , Attribute )})
297+ cls .frame_attributes = frame_attrs
298+
289299 # Deal with setting the name of the frame:
290300 if not hasattr (cls , 'name' ):
291301 cls .name = cls .__name__ .lower ()
0 commit comments