From bf79cabd70527048f2a754a351958c75bfc81c4f Mon Sep 17 00:00:00 2001 From: Alex Liberzon Date: Sat, 18 Nov 2023 11:41:07 +0200 Subject: [PATCH] bug captured by mypy --- mypy.ini | 16 ++++++++++++++++ openptv_python/calibration.py | 2 +- openptv_python/track.py | 4 ++-- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 mypy.ini diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..e5d1ae2 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,16 @@ +[mypy] +ignore_missing_imports = True +; disallow_untyped_defs = True +; disallow_incomplete_defs = True +; check_untyped_defs = True +; warn_unused_ignores = True +; warn_redundant_casts = True +; warn_unused_configs = True +; warn_return_any = True +; warn_unreachable = True +; show_error_codes = True +; pretty = True +; strict_optional = False + +[mypy-scipy.*] +ignore_errors = True diff --git a/openptv_python/calibration.py b/openptv_python/calibration.py index 1e57dbe..d226018 100644 --- a/openptv_python/calibration.py +++ b/openptv_python/calibration.py @@ -169,7 +169,7 @@ def from_file(self, ori_file: str, add_file: str) -> None: ------- - Ex, In, G, addp: Calibration object parts without multimedia lookup table. """ - if not pathlib.Path(ori_file).exists: + if not pathlib.Path(ori_file).exists(): raise IOError(f"File {ori_file} does not exist") with open(ori_file, "r", encoding="utf-8") as fp: diff --git a/openptv_python/track.py b/openptv_python/track.py index 33ca541..a181422 100644 --- a/openptv_python/track.py +++ b/openptv_python/track.py @@ -241,7 +241,7 @@ def angle_acc( angle = 0 else: angle = (200.0 / math.pi) * math.acos( - sum([v0[i] * v1[i] for i in range(3)]) + math.fsum([v0[i] * v1[i] for i in range(3)]) / (math.dist(start, pred) * math.dist(start, cand)) ) @@ -373,7 +373,7 @@ def candsearch_in_pix_rest( # binarized search for start point of candidate search j0, dj = num_targets // 2, num_targets // 4 while dj > 1: - j0 += dj if next_frame[j0, 1] < ymin else -dj + j0 += dj if next_frame[j0].y < ymin else -dj dj //= 2 j0 -= 12 if j0 >= 12 else j0 # due to trunc