Skip to content

Commit 44cc2ff

Browse files
authored
♻️ refactor: run ruff unsafe-fixes (#472)
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
1 parent 2c5b5f4 commit 44cc2ff

23 files changed

Lines changed: 59 additions & 52 deletions

File tree

src/coordinax/_coordinax_space_frames/frame_transforms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Astronomy reference frames."""
2-
# ruff:noqa: N806
32

43
__all__: tuple[str, ...] = ()
54

src/coordinax/_interop/coordinax_interop_astropy/converters.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def apycart3_to_cart3(obj: apyc.CartesianRepresentation, /) -> cx.CartesianPos3D
123123
)
124124
125125
"""
126-
return cast(cx.CartesianPos3D, cx.CartesianPos3D.from_(obj))
126+
return cast("cx.CartesianPos3D", cx.CartesianPos3D.from_(obj))
127127

128128

129129
# =====================================
@@ -177,7 +177,7 @@ def apycyl_to_cyl(obj: apyc.CylindricalRepresentation, /) -> cx.vecs.Cylindrical
177177
)
178178
179179
"""
180-
return cast(cx.vecs.CylindricalPos, cx.vecs.CylindricalPos.from_(obj))
180+
return cast("cx.vecs.CylindricalPos", cx.vecs.CylindricalPos.from_(obj))
181181

182182

183183
# =====================================
@@ -228,7 +228,7 @@ def apysph_to_sph(obj: apyc.PhysicsSphericalRepresentation, /) -> cx.SphericalPo
228228
)
229229
230230
"""
231-
return cast(cx.SphericalPos, cx.SphericalPos.from_(obj))
231+
return cast("cx.SphericalPos", cx.SphericalPos.from_(obj))
232232

233233

234234
# =====================================
@@ -284,7 +284,7 @@ def apysph_to_lonlatsph(
284284
)
285285
286286
"""
287-
return cast(cx.vecs.LonLatSphericalPos, cx.vecs.LonLatSphericalPos.from_(obj))
287+
return cast("cx.vecs.LonLatSphericalPos", cx.vecs.LonLatSphericalPos.from_(obj))
288288

289289

290290
# =====================================
@@ -334,7 +334,7 @@ def apycart3_to_diffcart3(obj: apyc.CartesianDifferential, /) -> cx.CartesianVel
334334
)
335335
336336
"""
337-
return cast(cx.CartesianVel3D, cx.CartesianVel3D.from_(obj))
337+
return cast("cx.CartesianVel3D", cx.CartesianVel3D.from_(obj))
338338

339339

340340
# =====================================
@@ -393,7 +393,7 @@ def apycyl_to_diffcyl(obj: apyc.CylindricalDifferential, /) -> cx.vecs.Cylindric
393393
)
394394
395395
"""
396-
return cast(cx.vecs.CylindricalVel, cx.vecs.CylindricalVel.from_(obj))
396+
return cast("cx.vecs.CylindricalVel", cx.vecs.CylindricalVel.from_(obj))
397397

398398

399399
# =====================================
@@ -451,7 +451,7 @@ def apysph_to_diffsph(obj: apyc.PhysicsSphericalDifferential, /) -> cx.Spherical
451451
)
452452
453453
"""
454-
return cast(cx.SphericalVel, cx.SphericalVel.from_(obj))
454+
return cast("cx.SphericalVel", cx.SphericalVel.from_(obj))
455455

456456

457457
# =====================================
@@ -513,7 +513,7 @@ def apysph_to_difflonlatsph(
513513
)
514514
515515
"""
516-
return cast(cx.vecs.LonLatSphericalVel, cx.vecs.LonLatSphericalVel.from_(obj))
516+
return cast("cx.vecs.LonLatSphericalVel", cx.vecs.LonLatSphericalVel.from_(obj))
517517

518518

519519
# =====================================
@@ -576,4 +576,6 @@ def apysph_to_diffloncoslatsph(
576576
)
577577
578578
"""
579-
return cast(cx.vecs.LonCosLatSphericalVel, cx.vecs.LonCosLatSphericalVel.from_(obj))
579+
return cast(
580+
"cx.vecs.LonCosLatSphericalVel", cx.vecs.LonCosLatSphericalVel.from_(obj)
581+
)

src/coordinax/_src/operators/boost.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def __call__(self: "VelocityBoost", p: AbstractVel, /) -> AbstractVel:
125125
[1 2 3]>
126126
127127
"""
128-
return cast(AbstractVel, p + self.velocity)
128+
return cast("AbstractVel", p + self.velocity)
129129

130130
# -------------------------------------------
131131
# Arithmetic operations

src/coordinax/_src/operators/galilean/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ruff: noqa: ERA001
21
"""Galilean coordinate transformations."""
32

43
__all__: list[str] = ["AbstractGalileanOperator"]

src/coordinax/_src/operators/galilean/boost.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ruff: noqa: ERA001
21
"""Galilean coordinate transformations."""
32

43
__all__ = ["GalileanBoost"]

src/coordinax/_src/operators/galilean/composite.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ruff: noqa: ERA001
21
"""Galilean coordinate transformations."""
32

43
__all__ = ["GalileanOperator"]
@@ -233,6 +232,6 @@ def simplify_op(op: GalileanOperator, /, **kwargs: Any) -> SimplifyOpR:
233232
not isinstance(x, type(orig))
234233
for x, orig in zip(simple_ops, op.operators, strict=True)
235234
):
236-
return cast(SimplifyOpR, Pipe(simple_ops).simplify())
235+
return cast("SimplifyOpR", Pipe(simple_ops).simplify())
237236

238237
return op

src/coordinax/_src/operators/galilean/rotation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Galilean coordinate transformations."""
2-
# ruff: noqa: N806
32

43
__all__ = ["GalileanRotation"]
54

src/coordinax/_src/operators/galilean/spatial_translation.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ruff: noqa: ERA001
21
"""Galilean coordinate transformations."""
32

43
__all__ = ["GalileanSpatialTranslation"]
@@ -41,11 +40,11 @@ def converter(x: Any) -> AbstractPos:
4140
shape: tuple[int, ...] = x.shape
4241
match shape:
4342
case (1,):
44-
out = cast(AbstractPos, CartesianPos1D.from_(x))
43+
out = cast("AbstractPos", CartesianPos1D.from_(x))
4544
case (2,):
46-
out = cast(AbstractPos, CartesianPos2D.from_(x))
45+
out = cast("AbstractPos", CartesianPos2D.from_(x))
4746
case (3,):
48-
out = cast(AbstractPos, CartesianPos3D.from_(x))
47+
out = cast("AbstractPos", CartesianPos3D.from_(x))
4948
case _:
5049
msg = f"Cannot convert {x} to a spatial translation vector."
5150
raise TypeError(msg)
@@ -275,7 +274,7 @@ def call(self: GalileanSpatialTranslation, q: AbstractPos, /, **__: Any) -> Abst
275274
[2 3 4]>
276275
277276
"""
278-
return cast(AbstractPos, q + self.delta_q)
277+
return cast("AbstractPos", q + self.delta_q)
279278

280279

281280
@AbstractOperator.__call__.dispatch

src/coordinax/_src/operators/galilean/translation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ruff: noqa: ERA001
21
"""Galilean coordinate transformations."""
32

43
__all__ = ["GalileanTranslation"]
@@ -138,7 +137,7 @@ def inverse(self) -> "GalileanTranslation":
138137
)
139138
140139
"""
141-
delta_q = cast(AbstractPos3D, -self.delta_q)
140+
delta_q = cast("AbstractPos3D", -self.delta_q)
142141
return GalileanTranslation(-self.delta_t, delta_q)
143142

144143
# -------------------------------------------

src/coordinax/_src/vectors/base_acc/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def norm(
8282
8383
"""
8484
cart_cls = self.cartesian_type
85-
cart_acc = cast(AbstractAcc, self.vconvert(cart_cls, p, q))
85+
cart_acc = cast("AbstractAcc", self.vconvert(cart_cls, p, q))
8686
return cart_acc.norm(p, q)
8787

8888

0 commit comments

Comments
 (0)