From 780fd54080da0b966e3d4fe6d07d93522e697ba8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:42:53 +0000 Subject: [PATCH 1/5] [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.7.3 → v0.8.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.3...v0.8.3) - [github.com/executablebooks/mdformat: 0.7.18 → 0.7.19](https://github.com/executablebooks/mdformat/compare/0.7.18...0.7.19) - [github.com/executablebooks/mdformat: 0.7.18 → 0.7.19](https://github.com/executablebooks/mdformat/compare/0.7.18...0.7.19) - [github.com/kynan/nbstripout: 0.8.0 → 0.8.1](https://github.com/kynan/nbstripout/compare/0.8.0...0.8.1) - [github.com/crate-ci/typos: typos-dict-v0.11.35 → v1.28.3](https://github.com/crate-ci/typos/compare/typos-dict-v0.11.35...v1.28.3) --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 69e41ee4..40ee22df 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: hooks: - id: sort-all - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.7.3 + rev: v0.8.3 hooks: - id: ruff-format - id: ruff @@ -38,7 +38,7 @@ repos: hooks: - id: refurb - repo: https://github.com/executablebooks/mdformat - rev: 0.7.18 + rev: 0.7.19 hooks: - id: mdformat additional_dependencies: [ @@ -48,7 +48,7 @@ repos: ] files: (README\.md) - repo: https://github.com/executablebooks/mdformat - rev: 0.7.18 + rev: 0.7.19 hooks: - id: mdformat additional_dependencies: [ @@ -58,12 +58,12 @@ repos: ] files: (docs/.) - repo: https://github.com/kynan/nbstripout - rev: 0.8.0 + rev: 0.8.1 hooks: - id: nbstripout exclude: (docs) - repo: https://github.com/crate-ci/typos - rev: typos-dict-v0.11.35 + rev: v1.28.3 hooks: - id: typos exclude: (\.ipynb) From ada262b838bab292150107f0a94c4c04421b4dba Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 19:43:29 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/_pytask/capture.py | 4 ++-- src/_pytask/mark/__init__.py | 2 +- src/_pytask/mark/expression.py | 2 +- src/_pytask/nodes.py | 2 +- src/_pytask/tree_util.py | 2 +- tests/test_collect_utils.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/_pytask/capture.py b/src/_pytask/capture.py index a4b03800..f90f88a5 100644 --- a/src/_pytask/capture.py +++ b/src/_pytask/capture.py @@ -328,7 +328,7 @@ def repr(self, class_name: str) -> str: return "<{} {} _old={} _state={!r} tmpfile={!r}>".format( class_name, self.name, - hasattr(self, "_old") and repr(self._old) or "", + (hasattr(self, "_old") and repr(self._old)) or "", self._state, self.tmpfile, ) @@ -337,7 +337,7 @@ def __repr__(self) -> str: return "<{} {} _old={} _state={!r} tmpfile={!r}>".format( self.__class__.__name__, self.name, - hasattr(self, "_old") and repr(self._old) or "", + (hasattr(self, "_old") and repr(self._old)) or "", self._state, self.tmpfile, ) diff --git a/src/_pytask/mark/__init__.py b/src/_pytask/mark/__init__.py index cf6968b7..e2586a46 100644 --- a/src/_pytask/mark/__init__.py +++ b/src/_pytask/mark/__init__.py @@ -36,8 +36,8 @@ __all__ = [ - "Expression", "MARK_GEN", + "Expression", "Mark", "MarkDecorator", "MarkGenerator", diff --git a/src/_pytask/mark/expression.py b/src/_pytask/mark/expression.py index e257751b..5300c15d 100644 --- a/src/_pytask/mark/expression.py +++ b/src/_pytask/mark/expression.py @@ -81,7 +81,7 @@ def __str__(self) -> str: class Scanner: - __slots__ = ("tokens", "current") + __slots__ = ("current", "tokens") def __init__(self, input_: str) -> None: self.tokens = self.lex(input_) diff --git a/src/_pytask/nodes.py b/src/_pytask/nodes.py index 4c678d9d..a0a1c0c3 100644 --- a/src/_pytask/nodes.py +++ b/src/_pytask/nodes.py @@ -7,7 +7,7 @@ import pickle from contextlib import suppress from os import stat_result -from pathlib import Path # noqa: TCH003 +from pathlib import Path # noqa: TC003 from typing import TYPE_CHECKING from typing import Any from typing import Callable diff --git a/src/_pytask/tree_util.py b/src/_pytask/tree_util.py index 43adbfbd..834b0a05 100644 --- a/src/_pytask/tree_util.py +++ b/src/_pytask/tree_util.py @@ -14,8 +14,8 @@ from optree import tree_structure as _optree_tree_structure __all__ = [ - "PyTree", "TREE_UTIL_LIB_DIRECTORY", + "PyTree", "tree_flatten_with_path", "tree_leaves", "tree_map", diff --git a/tests/test_collect_utils.py b/tests/test_collect_utils.py index 1c11406c..a2f95735 100644 --- a/tests/test_collect_utils.py +++ b/tests/test_collect_utils.py @@ -5,7 +5,7 @@ import pytest from _pytask.collect_utils import _find_args_with_product_annotation -from pytask import Product # noqa: TCH001 +from pytask import Product @pytest.mark.unit From d1caaa92aca3bc42ca6f676a37380282538dc35a Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Mon, 16 Dec 2024 21:43:37 +0100 Subject: [PATCH 3/5] Fix.2 --- .pre-commit-config.yaml | 4 ---- pyproject.toml | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 40ee22df..1c15e4d3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,10 +24,6 @@ repos: - id: python-check-mock-methods - id: python-no-log-warn - id: text-unicode-replacement-char -- repo: https://github.com/aio-libs/sort-all - rev: v1.3.0 - hooks: - - id: sort-all - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.8.3 hooks: diff --git a/pyproject.toml b/pyproject.toml index 288c1ce7..55d8f7fc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,8 +125,6 @@ extend-include = ["*.ipynb"] [tool.ruff.lint] select = ["ALL"] ignore = [ - "ANN101", - "ANN102", "ANN401", # flake8-annotate typing.Any "COM812", # Comply with ruff-format. "ISC001", # Comply with ruff-format. @@ -150,7 +148,7 @@ ignore = [ "scripts/*" = ["D", "INP001"] "docs/source/conf.py" = ["D401", "INP001"] "docs_src/*" = ["ARG001", "D", "INP001", "S301"] -"docs_src/*/*.py" = ["FA100", "FA102", "PLR2004", "TCH"] +"docs_src/*/*.py" = ["FA100", "FA102", "PLR2004", "TC"] "docs/source/how_to_guides/functional_interface*" = [ "B018", "D", From f718c25765b1049a0b6e215823e89757ef31f25d Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Mon, 16 Dec 2024 22:02:47 +0100 Subject: [PATCH 4/5] some slight fixes. --- .pre-commit-config.yaml | 8 ++++---- docs/source/how_to_guides/the_data_catalog.md | 2 +- docs/source/tutorials/defining_dependencies_products.md | 6 ++---- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1c15e4d3..0f27b278 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,8 +39,8 @@ repos: - id: mdformat additional_dependencies: [ mdformat-gfm, - mdformat-black, - mdformat-pyproject, + mdformat-ruff, + mdformat-pyproject>=0.0.2, ] files: (README\.md) - repo: https://github.com/executablebooks/mdformat @@ -49,8 +49,8 @@ repos: - id: mdformat additional_dependencies: [ mdformat-myst, - mdformat-black, - mdformat-pyproject, + mdformat-ruff, + mdformat-pyproject>=0.0.2, ] files: (docs/.) - repo: https://github.com/kynan/nbstripout diff --git a/docs/source/how_to_guides/the_data_catalog.md b/docs/source/how_to_guides/the_data_catalog.md index 140f5584..b0bc90e8 100644 --- a/docs/source/how_to_guides/the_data_catalog.md +++ b/docs/source/how_to_guides/the_data_catalog.md @@ -122,7 +122,7 @@ for model_name in MODEL_NAMES: @task def fit_model( - path: Path = Path("...", data_name) + path: Path = Path("...", data_name), ) -> Annotated[ Any, nested_data_catalogs[model_name][data_name]["fitted_model"] ]: diff --git a/docs/source/tutorials/defining_dependencies_products.md b/docs/source/tutorials/defining_dependencies_products.md index 0c847830..076f94b7 100644 --- a/docs/source/tutorials/defining_dependencies_products.md +++ b/docs/source/tutorials/defining_dependencies_products.md @@ -257,8 +257,7 @@ Applied to the tasks from before, we could have written `task_plot_data` as ```python @task(after=task_create_random_data) -def task_plot_data(...): - ... +def task_plot_data(): ... ``` You can also pass a list of task functions. @@ -268,8 +267,7 @@ tasks. Here, we can pass the function name or a significant part of the function ```python @task(after="random_data") -def task_plot_data(...): - ... +def task_plot_data(): ... ``` You will learn more about expressions in {doc}`selecting_tasks`. From 4f871a1cb0dfac716534f6d0bbe859eb07984115 Mon Sep 17 00:00:00 2001 From: Tobias Raabe Date: Mon, 16 Dec 2024 22:06:51 +0100 Subject: [PATCH 5/5] Fix mdformat issues. --- docs/source/how_to_guides/hashing_inputs_of_tasks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/how_to_guides/hashing_inputs_of_tasks.md b/docs/source/how_to_guides/hashing_inputs_of_tasks.md index 2c4c54b4..04a6d204 100644 --- a/docs/source/how_to_guides/hashing_inputs_of_tasks.md +++ b/docs/source/how_to_guides/hashing_inputs_of_tasks.md @@ -44,7 +44,7 @@ the `__hash__()` method of the object. Some objects like {class}`tuple` and {class}`typing.NamedTuple` are hashable and return correct hashes by default. -```python +```pycon >>> hash((1, 2)) -3550055125485641917 ``` @@ -54,7 +54,7 @@ from interpreter session to interpreter session for security reasons (see {meth}`object.__hash__` for more information). pytask will hash them using the {mod}`hashlib` module to create a stable hash. -```python +```pycon >>> from pytask import PythonNode >>> node = PythonNode(value="Hello, World!", hash=True) >>> node.state()