Skip to content

Commit 95d3379

Browse files
committed
Fix Array typing
1 parent 2844e0b commit 95d3379

12 files changed

Lines changed: 420 additions & 24 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
**/*.egg-info
44
.vscode/
55
/build
6+
/dist
67
# pixi environments
78
.pixi
89
*.egg-info

drone_models/_typing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from typing import Any, TypeAlias
2+
3+
import numpy.typing as npt
4+
5+
Array: TypeAlias = Any # To be changed to a Protocol later (see array-api#589)
6+
ArrayLike: TypeAlias = Array | npt.ArrayLike

drone_models/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
if TYPE_CHECKING:
1515
from types import ModuleType
1616

17-
from array_api_typing import Array
17+
from drone_models._typing import Array # To be changed to a Protocol later (see array-api#589)
1818

1919

2020
F = TypeVar("F", bound=Callable[..., Any])

drone_models/first_principles/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from drone_models.utils import rotation, to_xp
1414

1515
if TYPE_CHECKING:
16-
from array_api_typing import Array
16+
from drone_models._typing import Array # To be changed to a Protocol later (see array-api#589)
1717

1818

1919
@supports(rotor_dynamics=True)

drone_models/so_rpy/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from drone_models.utils import rotation, to_xp
1515

1616
if TYPE_CHECKING:
17-
from array_api_typing import Array
17+
from drone_models._typing import Array # To be changed to a Protocol later (see array-api#589)
1818

1919

2020
@supports(rotor_dynamics=False)

drone_models/so_rpy_rotor/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from drone_models.utils import rotation, to_xp
1515

1616
if TYPE_CHECKING:
17-
from array_api_typing import Array
17+
from drone_models._typing import Array # To be changed to a Protocol later (see array-api#589)
1818

1919

2020
@supports(rotor_dynamics=True)

drone_models/so_rpy_rotor_drag/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from drone_models.utils import rotation, to_xp
1515

1616
if TYPE_CHECKING:
17-
from array_api_typing import Array
17+
from drone_models._typing import Array # To be changed to a Protocol later (see array-api#589)
1818

1919
# Additional symbols specific to this model
2020
roll, pitch, yaw = cs.MX.sym("roll"), cs.MX.sym("pitch"), cs.MX.sym("yaw")

drone_models/transform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from array_api_compat import array_namespace
1313

1414
if TYPE_CHECKING:
15-
from array_api_typing import Array
15+
from drone_models._typing import Array # To be changed to a Protocol later (see array-api#589)
1616

1717

1818
def motor_force2rotor_vel(motor_forces: Array, rpm2thrust: Array) -> Array:

drone_models/utils/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
"""Utility functions for the drone models."""
22

3-
from types import ModuleType
4-
from typing import Any
3+
from __future__ import annotations
54

6-
from array_api_typing import Array
5+
from typing import TYPE_CHECKING, Any
6+
7+
if TYPE_CHECKING:
8+
from types import ModuleType
9+
10+
from drone_models._typing import Array # To be changed to a Protocol later (see array-api#589)
711

812

913
def to_xp(*args: Any, xp: ModuleType, device: Any) -> tuple[Array, ...] | Array:

pixi.lock

Lines changed: 390 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)