Skip to content

Commit

Permalink
Merge pull request astropy#16732 from eerovaher/no-unit-formatter-ins…
Browse files Browse the repository at this point in the history
…tances

Stop mentioning unit formatter instances
  • Loading branch information
pllim authored Jul 16, 2024
2 parents 2c17013 + c541931 commit 155f43c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions astropy/io/votable/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ def parse(
Therefore, *filename* is only required when source is a
file-like object.
unit_format : str, astropy.units.format.Base instance or None, optional
unit_format : str, astropy.units.format.Base subclass or None, optional
The unit format to use when parsing unit attributes. If a
string, must be the name of a unit formatter. The built-in
formats include ``generic``, ``fits``, ``cds``, and
``vounit``. A custom formatter may be provided by passing a
`~astropy.units.UnitBase` instance. If `None` (default),
`~astropy.units.format.Base` subclass. If `None` (default),
the unit format to use will be the one specified by the
VOTable specification (which is ``cds`` up to version 1.3 of
VOTable, and ``vounit`` in more recent versions of the spec).
Expand Down
4 changes: 2 additions & 2 deletions astropy/units/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ def to_string(self, format=unit_format.Generic, **kwargs):
Parameters
----------
format : `astropy.units.format.Base` instance or str
The name of a format or a formatter object. If not
format : `astropy.units.format.Base` subclass or str
The name of a format or a formatter class. If not
provided, defaults to the generic format.
**kwargs
Expand Down
10 changes: 4 additions & 6 deletions astropy/units/format/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,12 @@ def get_format(format=None):
Parameters
----------
format : str or `astropy.units.format.Base` instance or subclass
The name of the format, or the format instance or subclass
itself.
format : str or `astropy.units.format.Base` subclass
The name of the format, or the formatter class itself.
Returns
-------
format : `astropy.units.format.Base` instance
format : `astropy.units.format.Base` subclass
The requested formatter.
"""
if format is None:
Expand All @@ -95,8 +94,7 @@ def get_format(format=None):
return format
elif not (isinstance(format, str) or format is None):
raise TypeError(
f"Formatter must a subclass or instance of a subclass of {Base!r} "
f"or a string giving the name of the formatter. {_known_formats()}."
f"Expected a formatter name, not {format!r}. {_known_formats()}."
)

format_lower = format.lower()
Expand Down
4 changes: 2 additions & 2 deletions astropy/units/function/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ def to_string(self, format="generic", **kwargs):
Parameters
----------
format : `astropy.units.format.Base` instance or str
The name of a format or a formatter object. If not
format : `astropy.units.format.Base` subclass or str
The name of a format or a formatter class. If not
provided, defaults to the generic format.
"""
supported_formats = (
Expand Down
4 changes: 2 additions & 2 deletions astropy/units/structured.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,8 +424,8 @@ def to_string(self, format="generic"):
Parameters
----------
format : `astropy.units.format.Base` instance or str
The name of a format or a formatter object. If not
format : `astropy.units.format.Base` subclass or str
The name of a format or a formatter class. If not
provided, defaults to the generic format.
Notes
Expand Down
4 changes: 2 additions & 2 deletions astropy/visualization/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def quantity_support(format="latex_inline"):
Parameters
----------
format : `astropy.units.format.Base` instance or str
The name of a format or a formatter object. If not
format : `astropy.units.format.Base` subclass or str
The name of a format or a formatter class. If not
provided, defaults to ``latex_inline``.
"""
Expand Down

0 comments on commit 155f43c

Please sign in to comment.