Skip to content

Commit bfc34ae

Browse files
authored
Merge pull request #238 from sandialabs/pre-commit-ci-update-config
ci: pre-commit auto-update
2 parents e938f71 + de55a8b commit bfc34ae

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ci:
77
repos:
88

99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.13.3
10+
rev: v0.14.1
1111
hooks:
1212
- id: ruff-check
1313
- id: ruff-format

example/ex_6_creating_retryable_stages.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import sys
1515
from argparse import ArgumentParser
1616
from pathlib import Path
17-
from typing import Optional
1817

1918
from staged_script import RetryStage, StagedScript
2019

@@ -24,7 +23,7 @@ def __init__(
2423
self,
2524
stages: set[str],
2625
*,
27-
console_force_terminal: Optional[bool] = None,
26+
console_force_terminal: bool | None = None,
2827
console_log_path: bool = True,
2928
print_commands: bool = True,
3029
) -> None:

example/ex_7_customizing_the_summary.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import sys
1717
from argparse import ArgumentParser
1818
from pathlib import Path
19-
from typing import Optional
2019

2120
from staged_script import RetryStage, StagedScript
2221

@@ -26,7 +25,7 @@ def __init__(
2625
self,
2726
stages: set[str],
2827
*,
29-
console_force_terminal: Optional[bool] = None,
28+
console_force_terminal: bool | None = None,
3029
console_log_path: bool = True,
3130
print_commands: bool = True,
3231
) -> None:
@@ -147,7 +146,7 @@ def _end_stage_goodbye(self) -> None:
147146

148147
def print_script_execution_summary(
149148
self,
150-
extra_sections: Optional[dict[str, str]] = None,
149+
extra_sections: dict[str, str] | None = None,
151150
) -> None:
152151
extras = {
153152
"Machine details": (

staged_script/staged_script.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from datetime import datetime, timedelta, timezone
2727
from pathlib import Path
2828
from subprocess import CompletedProcess
29-
from typing import Any, Callable, NamedTuple, NoReturn, Optional
29+
from typing import Any, NamedTuple, NoReturn, TYPE_CHECKING
3030

3131
import __main__
3232
import rich.traceback
@@ -40,6 +40,9 @@
4040
from tenacity.stop import stop_after_attempt, stop_after_delay
4141
from tenacity.wait import wait_fixed
4242

43+
if TYPE_CHECKING:
44+
from collections.abc import Callable # pragma: no cover
45+
4346
rich.traceback.install()
4447

4548

@@ -142,7 +145,7 @@ def __init__(
142145
self,
143146
stages: set[str],
144147
*,
145-
console_force_terminal: Optional[bool] = None,
148+
console_force_terminal: bool | None = None,
146149
console_log_path: bool = True,
147150
print_commands: bool = True,
148151
) -> None:
@@ -787,7 +790,7 @@ def run(
787790
command: str,
788791
*,
789792
pretty_print: bool = False,
790-
print_command: Optional[bool] = None,
793+
print_command: bool | None = None,
791794
**kwargs: Any, # noqa: ANN401
792795
) -> CompletedProcess:
793796
"""
@@ -865,7 +868,7 @@ def pretty_print_command(self, command: str, indent: int = 4) -> str:
865868
#
866869

867870
def print_script_execution_summary(
868-
self, extra_sections: Optional[dict[str, str]] = None
871+
self, extra_sections: dict[str, str] | None = None
869872
) -> None:
870873
"""
871874
Print a summary of everything that was done by the script.
@@ -887,7 +890,7 @@ def print_script_execution_summary(
887890
888891
def print_script_execution_summary(
889892
self,
890-
extra_sections: Optional[dict[str, str]] = None
893+
extra_sections: dict[str, str] | None = None
891894
) -> None:
892895
extras = {"Additional section": "With some details."}
893896
if extra_sections is not None:

test/test_staged_script.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import shlex
1212
from datetime import datetime, timedelta, timezone
1313
from subprocess import CompletedProcess
14-
from typing import Optional
1514
from unittest.mock import MagicMock, patch
1615

1716
import pytest
@@ -254,7 +253,7 @@ def test_run_dry_run(
254253
)
255254
def test_print_script_execution_summary(
256255
mock_get_pretty_command_line_invocation: MagicMock,
257-
extras: Optional[dict[str, str]],
256+
extras: dict[str, str] | None,
258257
script_success: bool, # noqa: FBT001
259258
script: StagedScript,
260259
capsys: pytest.CaptureFixture,

0 commit comments

Comments
 (0)