Skip to content

Commit

Permalink
feat: complete deprecation of Unscaled
Browse files Browse the repository at this point in the history
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
  • Loading branch information
nstarman committed Jul 11, 2024
1 parent 9f8d567 commit 72d05e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
3 changes: 1 addition & 2 deletions astropy/units/format/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from .cds import CDS
from .console import Console
from .fits import FITS
from .generic import Generic, Unscaled
from .generic import Generic
from .latex import Latex, LatexInline
from .ogip import OGIP
from .unicode_format import Unicode
Expand All @@ -38,7 +38,6 @@
"LatexInline",
"OGIP",
"Unicode",
"Unscaled",
"VOUnit",
"get_format",
]
Expand Down
20 changes: 1 addition & 19 deletions astropy/units/format/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from fractions import Fraction
from typing import TYPE_CHECKING

from astropy.utils import classproperty, deprecated, parsing
from astropy.utils import classproperty, parsing
from astropy.utils.misc import did_you_mean

from . import core
Expand Down Expand Up @@ -661,21 +661,3 @@ def _to_decomposed_alternative(cls, unit: UnitBase) -> str:
unit = copy(unit)
unit._scale = 1.0
return f"{cls.to_string(unit)} (with data multiplied by {scale})"


# 2023-02-18: The statement in the docstring is no longer true, the class is not used
# anywhere so can be safely removed in 6.0.
@deprecated("5.3", alternative="Generic")
class Unscaled(Generic):
"""
A format that doesn't display the scale part of the unit, other
than that, it is identical to the `Generic` format.
This is used in some error messages where the scale is irrelevant.
"""

@classmethod
def to_string(cls, unit):
if unit.scale != 1:
unit = core.Unit(unit / unit.scale)
return super().to_string(unit)

0 comments on commit 72d05e9

Please sign in to comment.