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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
args: ['--maxkb=25']
Expand All @@ -25,7 +25,7 @@ repos:
- id: python-no-log-warn
- id: text-unicode-replacement-char
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.4
rev: v0.13.2
hooks:
- id: ruff-format
- id: ruff-check
Expand Down Expand Up @@ -55,7 +55,7 @@ repos:
- id: nbstripout
exclude: (docs)
- repo: https://github.com/crate-ci/typos
rev: v1.34.0
rev: v1
hooks:
- id: typos
exclude: (\.ipynb)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ ignore = [
"COM812", # Comply with ruff-format.
"ISC001", # Comply with ruff-format.
"FBT",
"PD901", # Avoid generic df for dataframes.
"S101", # raise errors for asserts.
"S603", # Call check with subprocess.run.
"S607", # Call subprocess.run with partial executable path.
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def build( # noqa: C901, PLR0912, PLR0913

session = Session.from_config(config_)

except (ConfigurationError, Exception):
except (ConfigurationError, Exception): # noqa: BLE001
console.print(Traceback(sys.exc_info()))
session = Session(exit_code=ExitCode.CONFIGURATION_FAILED)

Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/click.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def parse_args(self, ctx: Context, args: list[str]) -> list[str]:
opts, args, param_order = parser.parse_args(args=args)

for param in _iter_params_for_processing(param_order, self.get_params(ctx)):
value, args = param.handle_parse_result(ctx, opts, args)
_value, args = param.handle_parse_result(ctx, opts, args)

if args and not ctx.allow_extra_args and not ctx.resilient_parsing:
ctx.fail(
Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/collect_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def collect(**raw_config: Any | None) -> NoReturn:
config = pm.hook.pytask_configure(pm=pm, raw_config=raw_config)
session = Session.from_config(config)

except (ConfigurationError, Exception): # pragma: no cover
except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover
session = Session(exit_code=ExitCode.CONFIGURATION_FAILED)
console.print_exception()

Expand Down
4 changes: 2 additions & 2 deletions src/_pytask/dag_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def dag(**raw_config: Any) -> int:
config = pm.hook.pytask_configure(pm=pm, raw_config=raw_config)
session = Session.from_config(config)

except (ConfigurationError, Exception): # pragma: no cover
except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover
console.print_exception()
session = Session(exit_code=ExitCode.CONFIGURATION_FAILED)

Expand Down Expand Up @@ -183,7 +183,7 @@ def build_dag(raw_config: dict[str, Any]) -> nx.DiGraph:

session = Session.from_config(config)

except (ConfigurationError, Exception): # pragma: no cover
except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover
console.print_exception()
session = Session(exit_code=ExitCode.CONFIGURATION_FAILED)

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 @@ -59,7 +59,7 @@ def markers(**raw_config: Any) -> NoReturn:
config = pm.hook.pytask_configure(pm=pm, raw_config=raw_config)
session = Session.from_config(config)

except (ConfigurationError, Exception): # pragma: no cover
except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover
console.print_exception()
session = Session(exit_code=ExitCode.CONFIGURATION_FAILED)

Expand Down
2 changes: 1 addition & 1 deletion src/_pytask/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def profile(**raw_config: Any) -> NoReturn:
config = pm.hook.pytask_configure(pm=pm, raw_config=raw_config)
session = Session.from_config(config)

except (ConfigurationError, Exception): # pragma: no cover
except (ConfigurationError, Exception): # noqa: BLE001 # pragma: no cover
session = Session(exit_code=ExitCode.CONFIGURATION_FAILED)
console.print(Traceback(sys.exc_info()))

Expand Down
14 changes: 7 additions & 7 deletions tests/test_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ def test_capturing_basic_api(self, method):
assert outerr == ("", "")
print("hello")
capman.suspend()
out, err = capman.read()
out, _err = capman.read()
if method == CaptureMethod.NO:
assert old == (sys.stdout, sys.stderr, sys.stdin)
else:
assert not out
capman.resume()
print("hello")
capman.suspend()
out, err = capman.read()
out, _err = capman.read()
if method != CaptureMethod.NO:
assert out == "hello\n"
capman.stop_capturing()
Expand Down Expand Up @@ -624,7 +624,7 @@ def test_capture_results_accessible_by_attribute(self):
def test_capturing_readouterr_unicode(self):
with self.getcapture() as cap:
print("hxąć")
out, err = cap.readouterr()
out, _err = cap.readouterr()
assert out == "hxąć\n"

def test_reset_twice_error(self):
Expand Down Expand Up @@ -656,8 +656,8 @@ def test_capturing_error_recursive(self):
print("cap1")
with self.getcapture() as cap2:
print("cap2")
out2, err2 = cap2.readouterr()
out1, err1 = cap1.readouterr()
out2, _err2 = cap2.readouterr()
out1, _err1 = cap1.readouterr()
assert out1 == "cap1\n"
assert out2 == "cap2\n"

Expand Down Expand Up @@ -702,8 +702,8 @@ def test_capturing_error_recursive(self):
print("cap1")
with self.getcapture() as cap2:
print("cap2")
out2, err2 = cap2.readouterr()
out1, err1 = cap1.readouterr()
out2, _err2 = cap2.readouterr()
out1, _err1 = cap1.readouterr()
assert out1 == "cap1\ncap2\n"
assert out2 == "cap2\n"

Expand Down
2 changes: 1 addition & 1 deletion tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,5 @@ def test_no_version_raises(monkeypatch):
sys.modules[name] = module
monkeypatch.setitem(_MINIMUM_VERSIONS, name, "1.0.0")

with pytest.raises(ImportError, match="Can't determine .* fakemodule"):
with pytest.raises(ImportError, match=r"Can't determine .* fakemodule"):
import_optional_dependency(name)
2 changes: 1 addition & 1 deletion tests/test_dag_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def test_raise_error_for_cycle_in_graph(dag):
"115f685b0af2aef0c7317a0b48562f34cfb7a622549562bd3d34d4d948b4fdab",
"55c6cef62d3e62d5f8fc65bb846e66d8d0d3ca60608c04f6f7b095ea073a7dcf",
)
with pytest.raises(ValueError, match="The DAG contains cycles."):
with pytest.raises(ValueError, match=r"The DAG contains cycles\."):
TopologicalSorter.from_dag(dag)


Expand Down