From 4ded055a792725e3a9d465c5de512fd8fcfe4e84 Mon Sep 17 00:00:00 2001 From: Benjamin Rodenberg Date: Wed, 27 Nov 2024 16:08:08 +0100 Subject: [PATCH] Improve type hints. --- oscillator-overlap/solver-python/mypy.ini | 7 +++++++ oscillator-overlap/solver-python/problemDefinition.py | 5 +++-- oscillator/solver-python/problemDefinition.py | 5 +++-- 3 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 oscillator-overlap/solver-python/mypy.ini diff --git a/oscillator-overlap/solver-python/mypy.ini b/oscillator-overlap/solver-python/mypy.ini new file mode 100644 index 000000000..ff162b0b1 --- /dev/null +++ b/oscillator-overlap/solver-python/mypy.ini @@ -0,0 +1,7 @@ +[mypy] + +[mypy-scipy.*] +ignore_missing_imports = True + +[mypy-precice.*] +ignore_missing_imports = True \ No newline at end of file diff --git a/oscillator-overlap/solver-python/problemDefinition.py b/oscillator-overlap/solver-python/problemDefinition.py index 65ca35d63..a69d87721 100644 --- a/oscillator-overlap/solver-python/problemDefinition.py +++ b/oscillator-overlap/solver-python/problemDefinition.py @@ -1,5 +1,6 @@ import numpy as np from numpy.linalg import eig +from numpy.typing import NDArray from typing import Callable @@ -23,8 +24,8 @@ class Mass: m: float u0: float v0: float - u_analytical: Callable[[float | np.ndarray], float | np.ndarray] - v_analytical: Callable[[float | np.ndarray], float | np.ndarray] + u_analytical: Callable[[float | NDArray], float | NDArray] + v_analytical: Callable[[float | NDArray], float | NDArray] class MassLeft(Mass): diff --git a/oscillator/solver-python/problemDefinition.py b/oscillator/solver-python/problemDefinition.py index 65ca35d63..a69d87721 100644 --- a/oscillator/solver-python/problemDefinition.py +++ b/oscillator/solver-python/problemDefinition.py @@ -1,5 +1,6 @@ import numpy as np from numpy.linalg import eig +from numpy.typing import NDArray from typing import Callable @@ -23,8 +24,8 @@ class Mass: m: float u0: float v0: float - u_analytical: Callable[[float | np.ndarray], float | np.ndarray] - v_analytical: Callable[[float | np.ndarray], float | np.ndarray] + u_analytical: Callable[[float | NDArray], float | NDArray] + v_analytical: Callable[[float | NDArray], float | NDArray] class MassLeft(Mass):