Skip to content

Commit 80f38fd

Browse files
enh: use typing.Self to annotate methods returning self. (#88)
1 parent 41f7bf5 commit 80f38fd

5 files changed

Lines changed: 12 additions & 13 deletions

File tree

.github/pull_request_template.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
### This PR is related to user story DLAB-
2-
31
## Description
42
Provide a short description about the work that has been done.
53

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest]
16-
python-version: ["3.10", "3.11"]
16+
python-version: ["3.11", "3.12", "3.13"]
1717

1818
steps:
1919
- uses: actions/checkout@v4
@@ -36,4 +36,4 @@ jobs:
3636

3737
- name: Build documentation
3838
run: hatch run docs:build
39-
if: ${{ (matrix.python-version == '3.10') && (matrix.os == 'ubuntu-latest')}}
39+
if: ${{ (matrix.python-version == '3.12') && (matrix.os == 'ubuntu-latest')}}

.github/workflows/deploy_public.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ jobs:
3535
steps:
3636
- uses: actions/checkout@v4
3737

38-
- name: Set up Python 3.10
38+
- name: Set up Python 3.12
3939
uses: actions/setup-python@v5
4040
with:
41-
python-version: "3.10"
41+
python-version: "3.12"
4242

4343
- name: Install dependencies
4444
run: |

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ authors = [
99
]
1010
description = "Sensor fusion algorithms and utilities for SMS Motion"
1111
readme = "README.md"
12-
requires-python = ">=3.10"
12+
requires-python = ">=3.11"
1313
classifiers = [
14-
"Programming Language :: Python :: 3.10",
1514
"Programming Language :: Python :: 3.11",
15+
"Programming Language :: Python :: 3.12",
16+
"Programming Language :: Python :: 3.13",
1617
"License :: OSI Approved :: MIT License",
1718
"Operating System :: OS Independent",
1819
]

src/smsfusion/_ins.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Any
3+
from typing import Any, Self
44

55
import numpy as np
66
from numba import njit
@@ -451,7 +451,7 @@ def update(
451451
f_imu: ArrayLike,
452452
w_imu: ArrayLike,
453453
degrees: bool = False,
454-
) -> "StrapdownINS": # TODO: Replace with ``typing.Self`` when Python > 3.11:
454+
) -> Self:
455455
"""
456456
Update the INS states by integrating the *strapdown navigation equations*.
457457
@@ -950,7 +950,7 @@ def update(
950950
head_degrees: bool = True,
951951
g_ref: bool = False,
952952
g_var: ArrayLike | None = None,
953-
) -> "AidedINS": # TODO: Replace with ``typing.Self`` when Python > 3.11
953+
) -> Self:
954954
"""
955955
Update/correct the AINS' state estimate with aiding measurements, and project
956956
ahead using IMU measurements.
@@ -1190,7 +1190,7 @@ def update(
11901190
degrees: bool = False,
11911191
pos_var: ArrayLike = np.array([1e6, 1e6, 1e6]),
11921192
vel_var: ArrayLike = np.array([1e2, 1e2, 1e2]),
1193-
) -> "VRU": # TODO: Replace with ``typing.Self`` when Python > 3.11
1193+
) -> Self:
11941194
"""
11951195
Update/correct the VRU's state estimate with pseudo aiding measurements
11961196
(i.e., zero velocity and zero position with corresponding variances), and
@@ -1325,7 +1325,7 @@ def update(
13251325
head_degrees: bool = True,
13261326
pos_var: ArrayLike = np.array([1e6, 1e6, 1e6]),
13271327
vel_var: ArrayLike = np.array([1e2, 1e2, 1e2]),
1328-
) -> "AHRS": # TODO: Replace with ``typing.Self`` when Python > 3.11
1328+
) -> Self:
13291329
"""
13301330
Update/correct the AHRS' state estimate with pseudo aiding measurements
13311331
(i.e., zero velocity and zero position with corresponding variances), and

0 commit comments

Comments
 (0)