Skip to content

Commit

Permalink
style: sort imports (#36)
Browse files Browse the repository at this point in the history
* style: sort imports
* style: turn off pylint handled by ruff

Signed-off-by: nstarman <nstarman@users.noreply.github.com>
  • Loading branch information
nstarman authored Feb 26, 2024
1 parent 72bdd9b commit 8125f5d
Show file tree
Hide file tree
Showing 21 changed files with 54 additions and 44 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@

[tool.ruff.lint.isort]
combine-as-imports = true
known-first-party = ["array_api_jax_compat", "jax_quantity"]
known-local-folder = ["vector"]


[tool.pylint]
Expand All @@ -203,6 +205,7 @@
"redefined-builtin", # handled by ruff
"unused-argument", # handled by ruff
"wrong-import-position",
"wrong-import-order", # handled by ruff
]
py-version = "3.10"
reports.output-format = "colorized"
Expand Down
5 changes: 3 additions & 2 deletions src/vector/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
from types import MappingProxyType
from typing import TYPE_CHECKING, Any, TypeVar

import array_api_jax_compat as xp
import astropy.units as u
import equinox as eqx
import jax
import jax.numpy as jnp
from jax import Device
from jax_quantity import Quantity
from plum import dispatch

import array_api_jax_compat as xp
from jax_quantity import Quantity

from ._utils import dataclass_items, full_shaped

if TYPE_CHECKING:
Expand Down
3 changes: 2 additions & 1 deletion src/vector/_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
__all__: list[str] = []


import array_api_jax_compat as xp
import equinox as eqx

import array_api_jax_compat as xp
from jax_quantity import Quantity

from vector._typing import BatchableAngle, BatchableLength
Expand Down
1 change: 1 addition & 0 deletions src/vector/_d1/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import equinox as eqx
import jax

from jax_quantity import Quantity

from vector._base import AbstractVector, AbstractVectorDifferential
Expand Down
6 changes: 3 additions & 3 deletions src/vector/_d1/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
from functools import partial
from typing import ClassVar, final

import array_api_jax_compat as xp
import equinox as eqx
import jax

import array_api_jax_compat as xp
from jax_quantity import Quantity

from .base import Abstract1DVector, Abstract1DVectorDifferential
from vector._checks import check_r_non_negative
from vector._typing import BatchableLength, BatchableSpeed

from .base import Abstract1DVector, Abstract1DVectorDifferential

##############################################################################
# Position

Expand Down
6 changes: 3 additions & 3 deletions src/vector/_d1/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
__all__: list[str] = []


import array_api_jax_compat as xp
from jax_quantity import Quantity
from jaxtyping import Shaped
from plum import conversion_method

from vector._utils import dataclass_values, full_shaped
import array_api_jax_compat as xp
from jax_quantity import Quantity

from .base import Abstract1DVector
from .builtin import Cartesian1DVector, CartesianDifferential1D
from vector._utils import dataclass_values, full_shaped

#####################################################################
# Quantity
Expand Down
3 changes: 1 addition & 2 deletions src/vector/_d1/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@

from plum import dispatch

from vector._base import AbstractVector

from .base import Abstract1DVector, Abstract1DVectorDifferential
from .builtin import (
Cartesian1DVector,
CartesianDifferential1D,
RadialDifferential,
RadialVector,
)
from vector._base import AbstractVector

###############################################################################
# 1D
Expand Down
1 change: 1 addition & 0 deletions src/vector/_d2/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import equinox as eqx
import jax

from jax_quantity import Quantity

from vector._base import AbstractVector, AbstractVectorDifferential
Expand Down
6 changes: 3 additions & 3 deletions src/vector/_d2/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
from functools import partial
from typing import ClassVar, final

import array_api_jax_compat as xp
import equinox as eqx
import jax

import array_api_jax_compat as xp
from jax_quantity import Quantity

from .base import Abstract2DVector, Abstract2DVectorDifferential
from vector._checks import check_phi_range, check_r_non_negative
from vector._typing import (
BatchableAngle,
Expand All @@ -27,8 +29,6 @@
BatchableSpeed,
)

from .base import Abstract2DVector, Abstract2DVectorDifferential

# =============================================================================
# 2D

Expand Down
6 changes: 3 additions & 3 deletions src/vector/_d2/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
__all__: list[str] = []


import array_api_jax_compat as xp
from jax_quantity import Quantity
from jaxtyping import Shaped
from plum import conversion_method

from vector._utils import dataclass_values, full_shaped
import array_api_jax_compat as xp
from jax_quantity import Quantity

from .base import Abstract2DVector
from .builtin import Cartesian2DVector, CartesianDifferential2D
from vector._utils import dataclass_values, full_shaped

#####################################################################
# Quantity
Expand Down
4 changes: 2 additions & 2 deletions src/vector/_d2/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

from typing import Any

import array_api_jax_compat as xp
from plum import dispatch

from vector._base import AbstractVector
import array_api_jax_compat as xp

from .base import Abstract2DVector, Abstract2DVectorDifferential
from .builtin import (
Expand All @@ -16,6 +15,7 @@
PolarDifferential,
PolarVector,
)
from vector._base import AbstractVector


@dispatch
Expand Down
1 change: 1 addition & 0 deletions src/vector/_d3/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import equinox as eqx
import jax

from jax_quantity import Quantity

from vector._base import AbstractVector, AbstractVectorDifferential
Expand Down
6 changes: 3 additions & 3 deletions src/vector/_d3/builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
from functools import partial
from typing import ClassVar, final

import array_api_jax_compat as xp
import equinox as eqx
import jax

import array_api_jax_compat as xp
from jax_quantity import Quantity

from .base import Abstract3DVector, Abstract3DVectorDifferential
from vector._checks import check_phi_range, check_r_non_negative, check_theta_range
from vector._typing import (
BatchableAngle,
Expand All @@ -27,8 +29,6 @@
BatchableSpeed,
)

from .base import Abstract3DVector, Abstract3DVectorDifferential

##############################################################################
# Position

Expand Down
6 changes: 3 additions & 3 deletions src/vector/_d3/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
__all__: list[str] = []


import array_api_jax_compat as xp
import astropy.coordinates as apyc
import astropy.units as apyu
from jax_quantity import Quantity
from jaxtyping import Shaped
from plum import conversion_method, convert

from vector._utils import dataclass_values, full_shaped
import array_api_jax_compat as xp
from jax_quantity import Quantity

from .base import Abstract3DVector
from .builtin import (
Expand All @@ -21,6 +20,7 @@
SphericalDifferential,
SphericalVector,
)
from vector._utils import dataclass_values, full_shaped

#####################################################################
# Quantity
Expand Down
4 changes: 2 additions & 2 deletions src/vector/_d3/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

from typing import Any

import array_api_jax_compat as xp
from plum import dispatch

from vector._base import AbstractVector
import array_api_jax_compat as xp

from .base import Abstract3DVector, Abstract3DVectorDifferential
from .builtin import (
Expand All @@ -18,6 +17,7 @@
SphericalDifferential,
SphericalVector,
)
from vector._base import AbstractVector

###############################################################################
# 3D
Expand Down
5 changes: 3 additions & 2 deletions src/vector/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
from typing import Any
from warnings import warn

import array_api_jax_compat as xp
import astropy.units as u
import jax
from jax_quantity import Quantity
from plum import dispatch

import array_api_jax_compat as xp
from jax_quantity import Quantity

from ._base import AbstractVector, AbstractVectorDifferential
from ._d1.base import Abstract1DVectorDifferential
from ._d1.builtin import Cartesian1DVector, RadialVector
Expand Down
3 changes: 2 additions & 1 deletion src/vector/_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

__all__: list[str] = []

from jax_quantity import Quantity
from jaxtyping import Float, Shaped

from jax_quantity import Quantity

FloatScalarQ = Float[Quantity, ""]
BatchFloatScalarQ = Shaped[FloatScalarQ, "*batch"]
BatchableFloatScalarQ = Shaped[FloatScalarQ, "*#batch"]
Expand Down
5 changes: 3 additions & 2 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
from types import MappingProxyType
from typing import Any

import array_api_jax_compat as xp
import jax.numpy as jnp
import pytest
from jax_quantity import Quantity
from quax import quaxify

import array_api_jax_compat as xp
from jax_quantity import Quantity

from vector import (
Abstract1DVector,
Abstract1DVectorDifferential,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_d1.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import astropy.units as u
import jax.numpy as jnp
import pytest
from jax_quantity import Quantity
from quax import quaxify

from jax_quantity import Quantity

from .test_base import AbstractVectorDifferentialTest, AbstractVectorTest, array_equal
from vector import (
AbstractVector,
Cartesian1DVector,
Expand All @@ -25,8 +27,6 @@
represent_as,
)

from .test_base import AbstractVectorDifferentialTest, AbstractVectorTest, array_equal

array_equal = quaxify(jnp.array_equal)


Expand Down
8 changes: 4 additions & 4 deletions tests/test_d2.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
"""Test :mod:`vector._d2`."""

import array_api_jax_compat as xp
import astropy.units as u
import jax.numpy as jnp
import pytest
from jax_quantity import Quantity
from quax import quaxify

import array_api_jax_compat as xp
from jax_quantity import Quantity

from .test_base import AbstractVectorDifferentialTest, AbstractVectorTest, array_equal
from vector import (
AbstractVector,
Cartesian1DVector,
Expand All @@ -26,8 +28,6 @@
represent_as,
)

from .test_base import AbstractVectorDifferentialTest, AbstractVectorTest, array_equal

hypot = quaxify(jnp.hypot)
allclose = quaxify(jnp.allclose)

Expand Down
10 changes: 5 additions & 5 deletions tests/test_d3.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
"""Test :mod:`vector._builtin`."""

import array_api_jax_compat as xp
import astropy.coordinates as apyc
import astropy.units as u
import jax.numpy as jnp
import numpy as np
import pytest
from jax_quantity import Quantity
from plum import convert

import array_api_jax_compat as xp
from jax_quantity import Quantity

from .test_base import AbstractVectorDifferentialTest, AbstractVectorTest, array_equal
from .test_d2 import hypot
from vector import (
AbstractVector,
Cartesian1DVector,
Expand All @@ -28,9 +31,6 @@
SphericalDifferential,
)

from .test_base import AbstractVectorDifferentialTest, AbstractVectorTest, array_equal
from .test_d2 import hypot


class Abstract3DVectorTest(AbstractVectorTest):
"""Test :class:`vector.Abstract3DVector`."""
Expand Down

0 comments on commit 8125f5d

Please sign in to comment.