From 373c95b50e3e4982fccbf3e32bc3854f8c5a7472 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:54:03 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.0.1 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.0.1...v5.0.0) - [github.com/PyCQA/isort: 5.9.3 → 5.13.2](https://github.com/PyCQA/isort/compare/5.9.3...5.13.2) - [github.com/psf/black: 21.9b0 → 24.10.0](https://github.com/psf/black/compare/21.9b0...24.10.0) - [github.com/PyCQA/flake8: 4.0.1 → 7.1.1](https://github.com/PyCQA/flake8/compare/4.0.1...7.1.1) --- .pre-commit-config.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ae668fb..9052ce4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v5.0.0 hooks: - id: no-commit-to-branch name: Don't commit to master @@ -8,17 +8,17 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/PyCQA/isort - rev: 5.9.3 + rev: 5.13.2 hooks: - id: isort additional_dependencies: [toml] # excludes all the init files from sorting exclude: ^.*\/__init__\.py$ - repo: https://github.com/psf/black - rev: 21.9b0 + rev: 24.10.0 hooks: - id: black - repo: https://github.com/PyCQA/flake8 - rev: 4.0.1 + rev: 7.1.1 hooks: - id: flake8 From 62e990a2fadea59ca548785685ad91816d2b1e7f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:54:16 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- nata/containers/core.py | 3 +-- nata/containers/grid.py | 9 +++------ nata/containers/particle.py | 13 ++++--------- nata/plots/figure.py | 20 +++++++++++--------- nata/types.py | 3 +-- nata/utils/zdf.py | 6 +++--- tests/containers/core_test.py | 6 ++---- tests/containers/grid_test.py | 3 +-- 8 files changed, 26 insertions(+), 37 deletions(-) diff --git a/nata/containers/core.py b/nata/containers/core.py index 053d173..3d606ba 100644 --- a/nata/containers/core.py +++ b/nata/containers/core.py @@ -20,8 +20,7 @@ class BackendType(Protocol): name: str @staticmethod - def is_valid_backend(location: Path) -> bool: - ... # pragma: no cover + def is_valid_backend(location: Path) -> bool: ... # pragma: no cover class HasBackends: diff --git a/nata/containers/grid.py b/nata/containers/grid.py index 5cae239..37b654e 100644 --- a/nata/containers/grid.py +++ b/nata/containers/grid.py @@ -72,12 +72,10 @@ class GridBackend(Protocol): name: str location: Path - def __init__(self, location: FileLocation) -> None: - ... + def __init__(self, location: FileLocation) -> None: ... @staticmethod - def is_valid_backend(location: FileLocation) -> bool: - ... + def is_valid_backend(location: FileLocation) -> bool: ... dataset_name: str dataset_label: str @@ -100,8 +98,7 @@ def is_valid_backend(location: FileLocation) -> bool: @runtime_checkable class GridDataReader(GridBackend, Protocol): - def get_data(self, indexing: Optional[BasicIndexing] = None) -> np.ndarray: - ... + def get_data(self, indexing: Optional[BasicIndexing] = None) -> np.ndarray: ... class GridArray( diff --git a/nata/containers/particle.py b/nata/containers/particle.py index 4ee4d10..5ef183e 100644 --- a/nata/containers/particle.py +++ b/nata/containers/particle.py @@ -83,12 +83,10 @@ class ParticleBackend(Protocol): name: str location: Path - def __init__(self, location: FileLocation) -> None: - ... + def __init__(self, location: FileLocation) -> None: ... @staticmethod - def is_valid_backend(location: FileLocation) -> bool: - ... + def is_valid_backend(location: FileLocation) -> bool: ... dataset_name: str dataset_label: str @@ -111,8 +109,7 @@ class ParticleDataReader(ParticleBackend, Protocol): def get_data( self, indexing: Optional[BasicIndexing] = None, - ) -> np.ndarray: - ... + ) -> np.ndarray: ... class Quantity( @@ -800,9 +797,7 @@ def _decay_to_ParticleDataset( time=self.time[index[0]], ) - def __getitem__( - self, key: Any - ) -> Union[ + def __getitem__(self, key: Any) -> Union[ "ParticleDataset", "ParticleArray", "Particle", diff --git a/nata/plots/figure.py b/nata/plots/figure.py index 1b7802a..c976273 100644 --- a/nata/plots/figure.py +++ b/nata/plots/figure.py @@ -101,15 +101,17 @@ def scatter( s=size, c=color if has_colors else None, color=color if has_single_color else None, - norm=mpl_norm_from_scale( - colorscale, - ( - colorrange[0] if colorrange else np.min(color), - colorrange[1] if colorrange else np.max(color), - ), - ) - if has_colors - else None, + norm=( + mpl_norm_from_scale( + colorscale, + ( + colorrange[0] if colorrange else np.min(color), + colorrange[1] if colorrange else np.max(color), + ), + ) + if has_colors + else None + ), cmap=colormap, alpha=alpha, ) diff --git a/nata/types.py b/nata/types.py index 7e332d2..6ee140c 100644 --- a/nata/types.py +++ b/nata/types.py @@ -86,8 +86,7 @@ class BackendType(Protocol): #: point to data, either to open a file or to retrieve it. location: Optional[FileLocation] - def __init__(self, location: FileLocation) -> None: - ... + def __init__(self, location: FileLocation) -> None: ... @staticmethod def is_valid_backend(location: FileLocation) -> bool: diff --git a/nata/utils/zdf.py b/nata/utils/zdf.py index 3757690..b30ad6e 100644 --- a/nata/utils/zdf.py +++ b/nata/utils/zdf.py @@ -738,9 +738,9 @@ def read_track_data(self, trackInfo): for i in range(itermap.shape[0]): trackID = itermap[i, 0] - 1 npoints = itermap[i, 1] - (trackData[trackID])[ - trackNp[trackID] : trackNp[trackID] + npoints, : - ] = data[idx : idx + npoints, :] + (trackData[trackID])[trackNp[trackID] : trackNp[trackID] + npoints, :] = ( + data[idx : idx + npoints, :] + ) trackNp[trackID] += npoints idx += npoints diff --git a/tests/containers/core_test.py b/tests/containers/core_test.py index 5790a76..88ca319 100644 --- a/tests/containers/core_test.py +++ b/tests/containers/core_test.py @@ -23,11 +23,9 @@ class ExtendedProtocol(Protocol): some_other_prop: Tuple[int, ...] @staticmethod - def is_valid_backend(location: Path) -> bool: - ... + def is_valid_backend(location: Path) -> bool: ... - def some_other_method(self, foo: int) -> float: - ... + def some_other_method(self, foo: int) -> float: ... return ExtendedProtocol diff --git a/tests/containers/grid_test.py b/tests/containers/grid_test.py index 4d5bb3c..4f6e7fb 100644 --- a/tests/containers/grid_test.py +++ b/tests/containers/grid_test.py @@ -33,8 +33,7 @@ def __init__(self, location: Union[str, Path]) -> None: raise NotImplementedError @staticmethod - def is_valid_backend(location: Union[str, Path]) -> bool: - ... + def is_valid_backend(location: Union[str, Path]) -> bool: ... dataset_name = str() dataset_label = str()