Skip to content

Commit

Permalink
docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
adrn committed Oct 16, 2024
1 parent 30e3239 commit 7c36942
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/unxt/_src/units/system/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,22 @@ def unitsystem(usys: AbstractUnitSystem, *units_: Any) -> AbstractUnitSystem:

@dispatch # type: ignore[no-redef]
def unitsystem(flag: type[AbstractUnitSystemFlag], *_: Any) -> AbstractUnitSystem:
"""Raise an exception since the flag is abstract."""
msg = "Do not use the AbstractUnitSystemFlag directly, only use subclasses."
raise TypeError(msg)


@dispatch # type: ignore[no-redef]
def unitsystem(flag: type[StandardUnitSystemFlag], *units_: Any) -> AbstractUnitSystem:
"""Create a standard unit system using the inputted units.
Examples
--------
>>> from unxt import unitsystem
>>> unitsystem(unitsystems.StandardUnitSystemFlag, u.kpc, u.Myr, u.Msun)
LengthTimeMassUnitSystem(length=Unit("kpc"), time=Unit("Myr"), mass=Unit("solMass"))

Check failure on line 209 in src/unxt/_src/units/system/core.py

View workflow job for this annotation

GitHub Actions / Check Interoperability (3.12, ubuntu-latest)

core.py line=208 column=1

Check failure on line 209 in src/unxt/_src/units/system/core.py

View workflow job for this annotation

GitHub Actions / Check Python 3.10 on ubuntu-latest

core.py line=208 column=1

Check failure on line 209 in src/unxt/_src/units/system/core.py

View workflow job for this annotation

GitHub Actions / Check Python 3.10 on macos-latest

core.py line=208 column=1

Check failure on line 209 in src/unxt/_src/units/system/core.py

View workflow job for this annotation

GitHub Actions / Check Python 3.12 on ubuntu-latest

core.py line=208 column=1

Check failure on line 209 in src/unxt/_src/units/system/core.py

View workflow job for this annotation

GitHub Actions / Check Python 3.12 on macos-latest

core.py line=208 column=1
"""
return unitsystem(*units_)


Expand Down

0 comments on commit 7c36942

Please sign in to comment.