From 30a6e334b42e145b4abe2d2ac3af5a39a4cfc779 Mon Sep 17 00:00:00 2001 From: tjlane Date: Wed, 30 Oct 2024 14:48:59 +0100 Subject: [PATCH] stricter ruff due to py311 --- .gitignore | 1 + meteor/__init__.py | 3 +++ meteor/diffmaps.py | 2 +- meteor/iterative.py | 2 +- meteor/rsmap.py | 3 ++- meteor/scale.py | 4 +--- meteor/tv.py | 3 ++- meteor/validate.py | 2 +- pyproject.toml | 2 +- test/unit/scripts/test_compute_iterative_tv_map.py | 3 ++- test/unit/test_diffmaps.py | 2 +- test/unit/test_io.py | 2 +- test/unit/test_tv.py | 2 +- 13 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 60a9371..1286f5f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ __pycache__/ *.so # Distribution / packaging +_version.py .Python build/ develop-eggs/ diff --git a/meteor/__init__.py b/meteor/__init__.py index e69de29..62d6a78 100644 --- a/meteor/__init__.py +++ b/meteor/__init__.py @@ -0,0 +1,3 @@ +__all__ = ["__version__", "version"] + +from ._version import __version__, version diff --git a/meteor/diffmaps.py b/meteor/diffmaps.py index bfd3f85..bff8b2e 100644 --- a/meteor/diffmaps.py +++ b/meteor/diffmaps.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Sequence +from collections.abc import Sequence import numpy as np import reciprocalspaceship as rs diff --git a/meteor/iterative.py b/meteor/iterative.py index 1168749..9077193 100644 --- a/meteor/iterative.py +++ b/meteor/iterative.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Callable +from collections.abc import Callable import numpy as np import pandas as pd diff --git a/meteor/rsmap.py b/meteor/rsmap.py index aebd333..f1d1531 100644 --- a/meteor/rsmap.py +++ b/meteor/rsmap.py @@ -1,7 +1,8 @@ from __future__ import annotations +from collections.abc import Callable from pathlib import Path -from typing import Any, Callable, ClassVar, Literal, overload +from typing import Any, ClassVar, Literal, overload import gemmi import numpy as np diff --git a/meteor/scale.py b/meteor/scale.py index 6181df6..ca63ca2 100644 --- a/meteor/scale.py +++ b/meteor/scale.py @@ -1,7 +1,5 @@ from __future__ import annotations -from typing import Tuple - import numpy as np import pandas as pd import reciprocalspaceship as rs @@ -9,7 +7,7 @@ from .rsmap import Map -ScaleParameters = Tuple[float, float, float, float, float, float, float] +ScaleParameters = tuple[float, float, float, float, float, float, float] """ 7x float tuple to hold anisotropic scaling parameters """ diff --git a/meteor/tv.py b/meteor/tv.py index 6909a85..88bd861 100644 --- a/meteor/tv.py +++ b/meteor/tv.py @@ -1,9 +1,10 @@ from __future__ import annotations import json +from collections.abc import Sequence from dataclasses import asdict, dataclass from pathlib import Path -from typing import Literal, Sequence, overload +from typing import Literal, overload import numpy as np from skimage.restoration import denoise_tv_chambolle diff --git a/meteor/validate.py b/meteor/validate.py index 36a946e..8a2885e 100644 --- a/meteor/validate.py +++ b/meteor/validate.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Callable, Sequence +from collections.abc import Callable, Sequence import numpy as np from scipy.optimize import minimize_scalar diff --git a/pyproject.toml b/pyproject.toml index 76b8b64..c1b6005 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ tests = [ "meteor.phaseboost" = "meteor.scripts.compute_iterative_tv_map:main" [tool.setuptools_scm] -version_file = "meteor/__init__.py" +version_file = "meteor/_version.py" [tool.mypy] disallow_untyped_calls = true diff --git a/test/unit/scripts/test_compute_iterative_tv_map.py b/test/unit/scripts/test_compute_iterative_tv_map.py index 94f229e..ab5ae8d 100644 --- a/test/unit/scripts/test_compute_iterative_tv_map.py +++ b/test/unit/scripts/test_compute_iterative_tv_map.py @@ -1,8 +1,9 @@ from __future__ import annotations import argparse +from collections.abc import Sequence from pathlib import Path -from typing import Any, Sequence +from typing import Any from unittest import mock import numpy as np diff --git a/test/unit/test_diffmaps.py b/test/unit/test_diffmaps.py index 30163a3..c280f88 100644 --- a/test/unit/test_diffmaps.py +++ b/test/unit/test_diffmaps.py @@ -1,4 +1,4 @@ -from typing import Callable +from collections.abc import Callable import numpy as np import pandas as pd diff --git a/test/unit/test_io.py b/test/unit/test_io.py index 1175248..5671e3a 100644 --- a/test/unit/test_io.py +++ b/test/unit/test_io.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import Callable +from collections.abc import Callable import pytest diff --git a/test/unit/test_tv.py b/test/unit/test_tv.py index 183ee25..ee455b2 100644 --- a/test/unit/test_tv.py +++ b/test/unit/test_tv.py @@ -1,8 +1,8 @@ from __future__ import annotations +from collections.abc import Sequence from dataclasses import asdict from pathlib import Path -from typing import Sequence import numpy as np import pandas as pd