Skip to content

Commit

Permalink
fix make_getter move in astropy 6
Browse files Browse the repository at this point in the history
  • Loading branch information
adrn committed Dec 5, 2023
1 parent 2ee56f0 commit b4b5cf6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions gala/dynamics/representation_nd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

__all__ = ['NDCartesianRepresentation', 'NDCartesianDifferential']

# TODO: Remove when astropy min version >=v6.0
try:
_make_getter = coord.representation._make_getter
except AttributeError:
_make_getter = coord.representation.base._make_getter


class NDMixin(object):

Expand Down Expand Up @@ -95,8 +101,9 @@ def __init__(self, x, differentials=None, unit=None, copy=True):
if not hasattr(cls, name):
setattr(cls, name,
property(
coord.representation._make_getter(name),
doc=(f"The '{name}' component of the points(s).")))
_make_getter(name),
doc=(f"The '{name}' component of the points(s)."))
)

def get_xyz(self, xyz_axis=0):
"""Return a vector array of the x, y, and z coordinates.
Expand Down Expand Up @@ -181,7 +188,7 @@ def __init__(self, d_x, unit=None, copy=True):
cls = self.__class__
if not hasattr(cls, name):
setattr(cls, name,
property(coord.representation._make_getter(name),
property(_make_getter(name),
doc=("The '{0}' component of the points(s)."
.format(name))))

Expand Down

0 comments on commit b4b5cf6

Please sign in to comment.