Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ 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.7.3
rev: v0.8.3
hooks:
- id: ruff-format
- id: ruff
Expand All @@ -38,32 +34,32 @@ repos:
hooks:
- id: refurb
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.18
rev: 0.7.19
hooks:
- 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
rev: 0.7.18
rev: 0.7.19
hooks:
- 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
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)
Expand Down
4 changes: 2 additions & 2 deletions docs/source/how_to_guides/hashing_inputs_of_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion docs/source/how_to_guides/the_data_catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
]:
Expand Down
6 changes: 2 additions & 4 deletions docs/source/tutorials/defining_dependencies_products.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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`.
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/_pytask/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<UNSET>",
(hasattr(self, "_old") and repr(self._old)) or "<UNSET>",
self._state,
self.tmpfile,
)
Expand All @@ -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 "<UNSET>",
(hasattr(self, "_old") and repr(self._old)) or "<UNSET>",
self._state,
self.tmpfile,
)
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/mark/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@


__all__ = [
"Expression",
"MARK_GEN",
"Expression",
"Mark",
"MarkDecorator",
"MarkGenerator",
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/mark/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/tree_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_collect_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading