From 0126a8ee37c2a6685a490b5ab51e63584fae5529 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 21:59:00 +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/astral-sh/ruff-pre-commit: v0.3.1 → v0.3.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.3.1...v0.3.2) - [github.com/dosisod/refurb: v1.28.0 → v2.0.0](https://github.com/dosisod/refurb/compare/v1.28.0...v2.0.0) - [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 026a3f29..c9334eae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,18 +33,18 @@ repos: hooks: - id: sort-all - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.1 + rev: v0.3.2 hooks: - id: ruff-format - id: ruff args: [--unsafe-fixes] - repo: https://github.com/dosisod/refurb - rev: v1.28.0 + rev: v2.0.0 hooks: - id: refurb args: [--ignore, FURB126] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.8.0 + rev: v1.9.0 hooks: - id: mypy additional_dependencies: [ From fa88d109d8c360f0f6af9d91c11cec018522a6f6 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Tue, 12 Mar 2024 23:44:16 +0100 Subject: [PATCH 2/2] fix. --- .github/workflows/main.yml | 3 --- .pre-commit-config.yaml | 2 -- src/_pytask/_hashlib.py | 2 +- src/_pytask/data_catalog.py | 2 +- tests/conftest.py | 4 ++-- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f714430c..1c1eb9ea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,9 +5,6 @@ concurrency: group: ${{ github.head_ref || github.run_id }} cancel-in-progress: true -env: - CONDA_EXE: mamba - on: push: branches: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c9334eae..fd2fe700 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -80,8 +80,6 @@ repos: - repo: https://github.com/nbQA-dev/nbQA rev: 1.8.4 hooks: - - id: nbqa-black - - id: nbqa-isort - id: nbqa-mypy args: [--ignore-missing-imports] - repo: https://github.com/kynan/nbstripout diff --git a/src/_pytask/_hashlib.py b/src/_pytask/_hashlib.py index a3c4edcf..ceab0134 100644 --- a/src/_pytask/_hashlib.py +++ b/src/_pytask/_hashlib.py @@ -232,5 +232,5 @@ def hash_value(value: Any) -> int | str: if isinstance(value, str): value = value.encode() if isinstance(value, bytes): - return str(hashlib.sha256(value).hexdigest()) + return hashlib.sha256(value).hexdigest() return hash(value) diff --git a/src/_pytask/data_catalog.py b/src/_pytask/data_catalog.py index ec0a6d67..f59c2040 100644 --- a/src/_pytask/data_catalog.py +++ b/src/_pytask/data_catalog.py @@ -99,7 +99,7 @@ def add(self, name: str, node: PNode | None = None) -> None: raise TypeError(msg) if node is None: - filename = str(hashlib.sha256(name.encode()).hexdigest()) + filename = hashlib.sha256(name.encode()).hexdigest() if isinstance(self.default_node, PPathNode): self.entries[name] = self.default_node( name=name, path=self.path / f"{filename}.pkl" diff --git a/tests/conftest.py b/tests/conftest.py index 673d0b04..b15c9aaa 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -55,7 +55,7 @@ class SysPathsSnapshot: """A snapshot for sys.path.""" def __init__(self) -> None: - self.__saved = list(sys.path), list(sys.meta_path) + self.__saved = sys.path.copy(), sys.meta_path.copy() def restore(self) -> None: sys.path[:], sys.meta_path[:] = self.__saved @@ -65,7 +65,7 @@ class SysModulesSnapshot: """A snapshot for sys.modules.""" def __init__(self) -> None: - self.__saved = dict(sys.modules) + self.__saved = sys.modules.copy() def restore(self) -> None: sys.modules.clear()