Skip to content

Commit

Permalink
🚚 resource(unitsystems): move private module (#366)
Browse files Browse the repository at this point in the history
* 🚚 resource(unitsystems): move private module
* ⬆️ dep-bump(plum): bumpt bugfix version
* πŸ’š ci(mypy): pin plum for pre-commit

Signed-off-by: Nathaniel Starkman <[email protected]>
  • Loading branch information
nstarman authored Jan 15, 2025
1 parent a9e0afb commit c165b3e
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ repos:
- id: mypy
files: src
additional_dependencies:
- plum-dispatch
- plum-dispatch>=2.5.6

- repo: https://github.com/codespell-project/codespell
rev: "v2.3.0"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"jaxlib>0.4.32",
"jaxtyping>=0.2.34",
"optional-dependencies>=0.3.2",
"plum-dispatch>=2.5.5",
"plum-dispatch>=2.5.6",
"quax>=0.0.5",
"quaxed>=0.7.1",
"xmmutablemap>=0.1",
Expand Down
3 changes: 2 additions & 1 deletion src/unxt/_src/quantity/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,8 @@ def from_(
# -----------------------------------------------
# Promotion rules

add_promotion_rule(AbstractQuantity, AbstractQuantity, AbstractQuantity) # type: ignore[no-untyped-call]
add_promotion_rule(AbstractQuantity, AbstractQuantity, AbstractQuantity)


# ===============================================================
# Support for ``at``.
Expand Down
2 changes: 1 addition & 1 deletion src/unxt/_src/quantity/register_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from unxt._src.dimensions import AbstractDimension, dimension_of
from unxt._src.units import unit
from unxt._src.units.api import AbstractUnits
from unxt._src.units.system import AbstractUnitSystem
from unxt._src.unitsystems import AbstractUnitSystem

# ===================================================================
# Get dimensions
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class SIUnitSystem(SingletonMixin, AbstractUnitSystem):
Examples
--------
>>> import unxt as u
>>> from unxt._src.units.system.builtin import SIUnitSystem
>>> from unxt._src.unitsystems.builtin import SIUnitSystem
>>> usys = SIUnitSystem(
... length=u.unit("meter"),
... time=u.unit("second"),
Expand Down Expand Up @@ -136,7 +136,7 @@ class CGSUnitSystem(SingletonMixin, AbstractUnitSystem):
Examples
--------
>>> import unxt as u
>>> from unxt._src.units.system.builtin import CGSUnitSystem
>>> from unxt._src.unitsystems.builtin import CGSUnitSystem
>>> usys = CGSUnitSystem(
... length=u.unit("centimeter"),
... time=u.unit("second"),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_dimension_name(pt: str, /) -> str:
Examples
--------
>>> from unxt._src.units.system.utils import get_dimension_name
>>> from unxt._src.unitsystems.utils import get_dimension_name
>>> get_dimension_name("length")
'length'
Expand Down Expand Up @@ -58,7 +58,7 @@ def get_dimension_name(pt: AbstractDimension, /) -> str:
Examples
--------
>>> import unxt as u
>>> from unxt._src.units.system.utils import get_dimension_name
>>> from unxt._src.unitsystems.utils import get_dimension_name
>>> get_dimension_name(u.dimension("length"))
'length'
Expand All @@ -84,7 +84,7 @@ def get_dimension_name(pt: Unit, /) -> str:
Examples
--------
>>> import unxt as u
>>> from unxt._src.units.system.utils import get_dimension_name
>>> from unxt._src.unitsystems.utils import get_dimension_name
>>> get_dimension_name(u.unit("km"))
'length'
Expand Down
2 changes: 1 addition & 1 deletion src/unxt/unitsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from .setup_package import RUNTIME_TYPECHECKER

with install_import_hook("unxt.unitsystems", RUNTIME_TYPECHECKER):
from ._src.units.system import (
from ._src.unitsystems import (
NAMED_UNIT_SYSTEMS,
UNITSYSTEMS_REGISTRY,
AbstractUnitSystem,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_unitsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import pytest

from unxt import dimension, unit, unitsystems
from unxt._src.units.system.base import _UNITSYSTEMS_REGISTRY
from unxt._src.unitsystems.base import _UNITSYSTEMS_REGISTRY
from unxt.unitsystems import (
AbstractUnitSystem,
AbstractUSysFlag,
Expand All @@ -28,7 +28,7 @@
def clean_unitsystems_registry(monkeypatch):
clean_registry = {}
monkeypatch.setattr(
"unxt._src.units.system.base._UNITSYSTEMS_REGISTRY", clean_registry
"unxt._src.unitsystems.base._UNITSYSTEMS_REGISTRY", clean_registry
)
return clean_registry

Expand Down
10 changes: 5 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c165b3e

Please sign in to comment.