8000 fix types · Robertleoj/spatialmath-python@c04cb19 · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit c04cb19

Browse files
committed
fix types
1 parent c2c412f commit c04cb19

File tree

6 files changed

+1753
-1755
lines changed

6 files changed

+1753
-1755
lines changed

poetry.lock

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ typing_extensions = "*"
4747
pre-commit = "*"
4848
sympy = "^1.13.3"
4949
colored = "^2.2.4"
50+
pyright = "^1.1.390"
5051

5152
[tool.poetry.group.dev.dependencies]
5253
sympy = "*"

spatialmath/base/animate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import numpy as np
44
import matplotlib.pyplot as plt
55
from matplotlib import animation
6+
from matplotlib.axes import Axes
67
import spatialmath.base as smb
78
from collections.abc import Iterable, Iterator
89
from spatialmath.base.types import ArrayLike, SO3Array, SE3Array, SO2Array, SE2Array
@@ -39,7 +40,7 @@ class Animate:
3940

4041
def __init__(
4142
self,
42-
ax: plt.Axes | None = None,
43+
ax: Axes | None = None,
4344
dim: ArrayLike | None = None,
4445
projection: str = "ortho",
4546
labels: tuple[str, str, str] = ("X", "Y", "Z"),

spatialmath/base/argcheck.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from typing import Any, cast, overload, Callable
1414

1515

16+
1617
# valid scalar types
1718
_scalartypes = (int, np.integer, float, np.floating) + symtype
1819

@@ -271,7 +272,7 @@ def getvector(
271272
v: ArrayLike,
272273
dim: int | None = None,
273274
out: str = "array",
274-
dtype: np.dtype = np.float64,
275+
dtype: type = np.float64,
275276
) -> NDArray: ...
276277

277278

@@ -280,7 +281,7 @@ def getvector(
280281
v: ArrayLike,
281282
dim: int | None = None,
282283
out: str = "list",
283-
dtype: np.dtype = np.float64,
284+
dtype: type = np.float64,
284285
) -> list[float]: ...
285286

286287

@@ -289,7 +290,7 @@ def getvector(
289290
v: tuple[float, ...],
290291
dim: int | None = None,
291292
out: str = "sequence",
292-
dtype: np.dtype = np.float64,
293+
dtype: type = np.float64,
293294
) -> tuple[float, ...]: ...
294295

295296

@@ -298,15 +299,15 @@ def getvector(
298299
v: list[float],
299300
dim: int | None = None,
300301
out: str = "sequence",
301-
dtype: np.dtype = np.float64,
302+
dtype: type = np.float64,
302303
) -> list[float]: ...
303304

304305

305306
def getvector(
306307
v: ArrayLike,
307308
dim: int | None = None,
308309
out: str = "array",
309-
dtype: np.dtype = np.float64,
310+
dtype: type = np.float64,
310311
) -> NDArray | list[float] | tuple[float, ...]:
311312
"""
312313
Return a vector value
@@ -543,6 +544,7 @@ def getunit(v: ArrayLike, unit: str = "rad", dim=None) -> float | NDArray:
543544
:seealso: :func:`getvector`
544545
"""
545546
if not isinstance(v, Iterable) and dim == 0:
547+
546548
# scalar in, scalar out
547549
if unit == "rad":
548550
return v

0 commit comments

Comments
 (0)
0