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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
- id: python-no-log-warn
- id: text-unicode-replacement-char
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.12
rev: v0.12.0
hooks:
- id: ruff-format
- id: ruff
Expand Down Expand Up @@ -58,7 +58,7 @@ repos:
- id: nbstripout
exclude: (docs)
- repo: https://github.com/crate-ci/typos
rev: v1.32.0
rev: v1
hooks:
- id: typos
exclude: (\.ipynb)
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def build( # noqa: C901, PLR0912, PLR0913
if "command" not in raw_config:
raw_config["command"] = "build"
# Add defaults from cli.
from _pytask.cli import DEFAULTS_FROM_CLI
from _pytask.cli import DEFAULTS_FROM_CLI # noqa: PLC0415

raw_config = {**DEFAULTS_FROM_CLI, **raw_config}

Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def _make_memoize_key(
if kwargs:
for i, arg in enumerate(argspec.args):
if arg in kwargs:
args = args[:i] + (kwargs.pop(arg),) + args[i:]
args = (*args[:i], kwargs.pop(arg), *args[i:])

if args:
key_args += args
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/dag_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def build_dag(raw_config: dict[str, Any]) -> nx.DiGraph:
if "command" not in raw_config:
raw_config["command"] = "dag"
# Add defaults from cli.
from _pytask.cli import DEFAULTS_FROM_CLI
from _pytask.cli import DEFAULTS_FROM_CLI # noqa: PLC0415

raw_config = {**DEFAULTS_FROM_CLI, **raw_config}

Expand Down
4 changes: 2 additions & 2 deletions src/_pytask/debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _import_pdb_cls(
) -> type[pdb.Pdb]:
"""Create a debugger from an imported class."""
if not cls._config:
import pdb # noqa: T100
import pdb # noqa: PLC0415, T100

# Happens when using pytask.set_trace outside of a task.
return pdb.Pdb
Expand All @@ -160,7 +160,7 @@ def _import_pdb_cls(
msg = f"--pdbcls: could not import {value!r}: {exc}."
raise ValueError(msg) from exc
else:
import pdb # noqa: T100
import pdb # noqa: PLC0415, T100

pdb_cls = pdb.Pdb

Expand Down
3 changes: 2 additions & 1 deletion src/_pytask/mark/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ def not_expr(s: Scanner) -> ast.expr:
ident = s.accept(TokenType.IDENT)
if ident:
return ast.Name(IDENT_PREFIX + ident.value, ast.Load())
s.reject((TokenType.NOT, TokenType.LPAREN, TokenType.IDENT)) # noqa: RET503
s.reject((TokenType.NOT, TokenType.LPAREN, TokenType.IDENT))
return None


class MatcherAdapter(Mapping[str, bool]):
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/warnings_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _resolve_warning_category(category: str) -> type[Warning]:
return Warning

if "." not in category:
import builtins as m
import builtins as m # noqa: PLC0415

klass = category
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def test_unicode_and_str_mixture(self):


def test_dontreadfrominput():
from _pytest.capture import DontReadFromInput
from _pytest.capture import DontReadFromInput # noqa: PLC0415

f = DontReadFromInput()
assert f.buffer is f
Expand Down
4 changes: 2 additions & 2 deletions tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_bad_version(monkeypatch):
result = import_optional_dependency("fakemodule", min_version="0.8")
assert result is module

with pytest.warns(UserWarning):
with pytest.warns(UserWarning, match=match):
result = import_optional_dependency("fakemodule", errors="warn")
assert result is None

Expand All @@ -134,7 +134,7 @@ def test_submodule(monkeypatch):
with pytest.raises(ImportError, match=match):
import_optional_dependency("fakemodule.submodule")

with pytest.warns(UserWarning):
with pytest.warns(UserWarning, match=match):
result = import_optional_dependency("fakemodule.submodule", errors="warn")
assert result is None

Expand Down
4 changes: 2 additions & 2 deletions tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_no_meta_path_found(
assert module.foo(2) == 42 # type: ignore[attr-defined]

# mode='importlib' fails if no spec is found to load the module
import importlib.util
import importlib.util # noqa: PLC0415

# Force module to be re-imported.
del sys.modules[module.__name__]
Expand Down Expand Up @@ -269,7 +269,7 @@ class Data:
)
)

import pickle
import pickle # noqa: PLC0415

def round_trip(obj):
s = pickle.dumps(obj)
Expand Down