Skip to content

Commit ef76d16

Browse files
committed
style: Finish type-hinting
1 parent b7c26fc commit ef76d16

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

example/ex_6_creating_retryable_stages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(
2727
console_force_terminal: Optional[bool] = None,
2828
console_log_path: bool = True,
2929
print_commands: bool = True,
30-
):
30+
) -> None:
3131
super().__init__(
3232
stages,
3333
console_force_terminal=console_force_terminal,

example/ex_7_customizing_the_summary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(
2929
console_force_terminal: Optional[bool] = None,
3030
console_log_path: bool = True,
3131
print_commands: bool = True,
32-
):
32+
) -> None:
3333
super().__init__(
3434
stages,
3535
console_force_terminal=console_force_terminal,

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ line-length = 79
7474
extend-select = [
7575
"A",
7676
"AIR",
77-
# "ANN",
77+
"ANN",
7878
"ARG",
7979
"ASYNC",
8080
"B",

staged_script/staged_script.py

Lines changed: 9 additions & 9 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 Callable, NamedTuple, Optional
29+
from typing import Any, Callable, NamedTuple, NoReturn, Optional
3030

3131
import __main__
3232
import rich.traceback
@@ -145,7 +145,7 @@ def __init__(
145145
console_force_terminal: Optional[bool] = None,
146146
console_log_path: bool = True,
147147
print_commands: bool = True,
148-
):
148+
) -> None:
149149
"""
150150
Initialize a :class:`StagedScript` object.
151151
@@ -248,7 +248,7 @@ def stage(stage_name: str, heading: str) -> Callable:
248248

249249
def decorator(func: Callable) -> Callable:
250250
def get_phase_method( # noqa: D417
251-
self,
251+
self, # noqa: ANN001
252252
method_name: str,
253253
) -> Callable:
254254
"""
@@ -273,9 +273,9 @@ def get_phase_method( # noqa: D417
273273
)
274274

275275
def run_retryable_phases( # noqa: D417
276-
self,
277-
*args,
278-
**kwargs,
276+
self, # noqa: ANN001
277+
*args: Any, # noqa: ANN401
278+
**kwargs: Any, # noqa: ANN401
279279
) -> None:
280280
"""
281281
Run the retryable phases.
@@ -310,7 +310,7 @@ def run_retryable_phases( # noqa: D417
310310
get_phase_method(self, "_end_stage")()
311311

312312
@functools.wraps(func)
313-
def wrapper(self, *args, **kwargs) -> None:
313+
def wrapper(self, *args: Any, **kwargs: Any) -> None: # noqa: ANN001, ANN401
314314
"""
315315
Turn a function into a stage.
316316
@@ -759,7 +759,7 @@ def parse_args(self, argv: list[str]) -> None:
759759
]:
760760
setattr(self, retry_arg, getattr(self.args, retry_arg, None))
761761

762-
def raise_parser_error(self, message):
762+
def raise_parser_error(self, message: str) -> NoReturn:
763763
"""
764764
Raise a parser error.
765765
@@ -788,7 +788,7 @@ def run(
788788
*,
789789
pretty_print: bool = False,
790790
print_command: Optional[bool] = None,
791-
**kwargs,
791+
**kwargs: Any, # noqa: ANN401
792792
) -> CompletedProcess:
793793
"""
794794
Run a command in the underlying shell.

0 commit comments

Comments
 (0)