diff --git a/pyproject.toml b/pyproject.toml index 8d3a57e5..c0b3d15b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,8 +72,8 @@ [tool.hatch] build.hooks.vcs.version-file = "src/galax/_version.py" envs.default.dependencies = ["pytest", "pytest-cov"] - version.source = "vcs" metadata.allow-direct-references = true + version.source = "vcs" [tool.pytest.ini_options] @@ -173,7 +173,7 @@ "F722", # Syntax error in forward annotation <- jaxtyping "F821", # undefined name <- jaxtyping "FIX002", # Line contains TODO, consider resolving the issue - "ISC001", # single-line-implicit-string-concatenation <- ruff-format + "ISC001", # Implicit string concatenation <- ruff-format "N80", # Naming conventions. "PD", # pandas-vet "PLR", # Design related pylint codes @@ -182,11 +182,6 @@ "TD002", # Missing author in TODO "TD003", # Missing issue link on the line following this TODO "UP037", # Remove quote from type annotation <- jaxtyping - # TODO: fix these - "ARG001", - "ARG002", - "ERA001", # commented-out code - "F841", ] # Uncomment if using a _compat.typing backport # typing-modules = ["galax._compat.typing"] @@ -202,6 +197,8 @@ "noxfile.py" = ["ERA001", "T20"] "tests/**" = [ "ANN", + "ARG001", + "ARG002", "D10", "E731", "INP001", diff --git a/src/galax/coordinates/_psp/utils.py b/src/galax/coordinates/_psp/utils.py index 9fafa5e5..fabdb43e 100644 --- a/src/galax/coordinates/_psp/utils.py +++ b/src/galax/coordinates/_psp/utils.py @@ -17,7 +17,8 @@ class Shaped(Protocol): def _getitem_broadscalartime_index_tuple( - index: tuple[Any, ...], t: FloatArrayAnyShape + index: tuple[Any, ...], + t: FloatArrayAnyShape, # noqa: ARG001 ) -> Any: """Get the time index from a slice.""" if len(index) == 0: # slice is an empty tuple diff --git a/src/galax/potential/_potential/base.py b/src/galax/potential/_potential/base.py index c557bee2..843ec9dc 100644 --- a/src/galax/potential/_potential/base.py +++ b/src/galax/potential/_potential/base.py @@ -329,7 +329,12 @@ def tidal_tensor( # Integrating orbits @partial(jax.jit) - def _integrator_F(self, t: FloatScalar, w: Vec6, args: tuple[Any, ...]) -> Vec6: + def _integrator_F( + self, + t: FloatScalar, + w: Vec6, + args: tuple[Any, ...], # noqa: ARG002 + ) -> Vec6: """Return the derivative of the phase-space position.""" return jnp.hstack([w[3:6], self.acceleration(w[0:3], t).value]) # v, a diff --git a/src/galax/potential/_potential/builtin.py b/src/galax/potential/_potential/builtin.py index 87a2eca8..0f31421a 100644 --- a/src/galax/potential/_potential/builtin.py +++ b/src/galax/potential/_potential/builtin.py @@ -210,6 +210,9 @@ class NullPotential(AbstractPotential): @partial(jax.jit) def _potential_energy( - self, q: BatchVec3, /, t: BatchableFloatOrIntScalarLike + self, + q: BatchVec3, + /, + t: BatchableFloatOrIntScalarLike, # noqa: ARG002 ) -> BatchFloatScalar: return xp.zeros(q.shape[:-1], dtype=q.dtype) diff --git a/src/galax/potential/_potential/io/gala_noop.py b/src/galax/potential/_potential/io/gala_noop.py index e8aac4d8..d5e31f71 100644 --- a/src/galax/potential/_potential/io/gala_noop.py +++ b/src/galax/potential/_potential/io/gala_noop.py @@ -14,7 +14,7 @@ _GALA_TO_GALAX_REGISTRY: dict["type[GalaPotentialBase]", type[AbstractPotential]] = {} -def gala_to_galax(pot: "GalaPotentialBase", /) -> AbstractPotentialBase: +def gala_to_galax(pot: "GalaPotentialBase", /) -> AbstractPotentialBase: # noqa: ARG001 """Convert a :mod:`gala` potential to a :mod:`galax` potential. Parameters diff --git a/src/galax/potential/_potential/param/core.py b/src/galax/potential/_potential/param/core.py index 68510add..51d2e2f8 100644 --- a/src/galax/potential/_potential/param/core.py +++ b/src/galax/potential/_potential/param/core.py @@ -111,7 +111,7 @@ def _call_helper(self, _: FloatOrIntScalar) -> FloatArrayAnyShape: @partial(jax.jit) def __call__( - self, t: BatchableFloatOrIntScalarLike = 0, **kwargs: Any + self, t: BatchableFloatOrIntScalarLike = 0, **_: Any ) -> FloatArrayAnyShape: """Return the constant parameter value. diff --git a/src/galax/potential/_potential/param/field.py b/src/galax/potential/_potential/param/field.py index 4d5a8e4f..d7384aca 100644 --- a/src/galax/potential/_potential/param/field.py +++ b/src/galax/potential/_potential/param/field.py @@ -116,7 +116,7 @@ def __set__( # Convert if isinstance(value, AbstractParameter): # TODO: this doesn't handle the correct output unit, a. la. - # potential.units[self.dimensions] + # ``potential.units[self.dimensions]`` # Check the unit is compatible self._check_unit(potential, value.unit) elif callable(value): diff --git a/src/galax/potential/_potential/utils.py b/src/galax/potential/_potential/utils.py index 22f4066a..cabd0373 100644 --- a/src/galax/potential/_potential/utils.py +++ b/src/galax/potential/_potential/utils.py @@ -32,7 +32,7 @@ def _from_usys(value: UnitSystem, /) -> UnitSystem: @converter_to_usys.register -def _from_none(value: None, /) -> UnitSystem: +def _from_none(_: None, /) -> UnitSystem: return dimensionless @@ -86,7 +86,7 @@ def convert_inputs_to_arrays( @singledispatch -def convert_input_to_array(value: Any, /, *, units: UnitSystem, **kwargs: Any) -> Any: +def convert_input_to_array(value: Any, /, *, units: UnitSystem, **_: Any) -> Any: """Parse input arguments. This function uses :func:`~functools.singledispatch` to dispatch on the type @@ -114,21 +114,23 @@ def convert_input_to_array(value: Any, /, *, units: UnitSystem, **kwargs: Any) - @convert_input_to_array.register(float) @convert_input_to_array.register(Array) def _convert_from_arraylike( - value: Value, /, *, units: UnitSystem, **kwargs: Any + value: Value, + /, + *, + units: UnitSystem, # noqa: ARG001 + **_: Any, ) -> Array: return xp.asarray(value) @convert_input_to_array.register(Quantity) -def _convert_from_quantity( - value: Quantity, /, *, units: UnitSystem, **kwargs: Any -) -> Array: +def _convert_from_quantity(value: Quantity, /, *, units: UnitSystem, **_: Any) -> Array: return xp.asarray(value.decompose(units).value) @convert_input_to_array.register(BaseRepresentationOrDifferential) def _convert_from_baserep( - value: BaseRepresentationOrDifferential, /, *, units: UnitSystem, **kwargs: Any + value: BaseRepresentationOrDifferential, /, *, units: UnitSystem, **_: Any ) -> Array: return xp.stack( [getattr(value, attr).decompose(units).value for attr in value.components] @@ -171,6 +173,6 @@ def _from_gala(value: GalaUnitSystem, /) -> UnitSystem: @converter_to_usys.register def _from_gala_dimensionless( - value: GalaDimensionlessUnitSystem, / + _: GalaDimensionlessUnitSystem, / ) -> DimensionlessUnitSystem: return dimensionless diff --git a/tests/unit/coordinates/psp/test_base.py b/tests/unit/coordinates/psp/test_base.py index e1327642..5a9c290f 100644 --- a/tests/unit/coordinates/psp/test_base.py +++ b/tests/unit/coordinates/psp/test_base.py @@ -152,7 +152,7 @@ def test_w(self, w: T) -> None: # Check existence assert hasattr(w, "w") - # units != None + # units are not None assert w.w(units=galactic).shape[:-1] == w.full_shape[:-1] # ========================================================================== diff --git a/tests/unit/coordinates/psp/test_utils.py b/tests/unit/coordinates/psp/test_utils.py index 16a4a419..ad45b1b5 100644 --- a/tests/unit/coordinates/psp/test_utils.py +++ b/tests/unit/coordinates/psp/test_utils.py @@ -92,7 +92,7 @@ def test_shaped_nd(self, t2x3: Vec2x3) -> None: index = jnp.array([True, False]) assert jnp.array_equal(self.get_index(index, t2x3), index) - # index.shape == t.shape + # index.shape equals t.shape index = jnp.array([[True, False], [False, True]]) assert jnp.array_equal(self.get_index(index, t2x3), index) @@ -175,9 +175,5 @@ def test_shaped_nd(self, t2x3: Vec2x3) -> None: assert jnp.array_equal(self.get_index(index, t2x3), index) index = jnp.array([[True, False], [False, True]]) - msg = ( - f"Index {index} has too many dimensions for " - f"time array of shape {t2x3.shape}" - ) with pytest.raises(IndexError): self.get_index(index, t2x3)