Skip to content

Commit 3d28d55

Browse files
committed
Use latest builtins
1 parent 6a04f59 commit 3d28d55

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

tests/test_command_tree.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import subprocess
22
import sys
33
from pathlib import Path
4-
from typing import List
54

65
import pytest
76

@@ -13,7 +12,7 @@
1312
OVERHEAD_LINES = 3 # footnote plus top/bottom of panel
1413

1514

16-
def prepare_lines(s: str) -> List[str]:
15+
def prepare_lines(s: str) -> list[str]:
1716
"""
1817
Takes a string and massages it to a list of modified lines.
1918
@@ -27,7 +26,7 @@ def prepare_lines(s: str) -> List[str]:
2726
return [line[2:].rstrip(". ") for line in unified.split("\n")]
2827

2928

30-
def find_in_lines(lines: List[str], cmd: str, help: str) -> bool:
29+
def find_in_lines(lines: list[str], cmd: str, help: str) -> bool:
3130
"""
3231
Looks for a line that starts with 'cmd', and also contains the 'help'.
3332
"""
@@ -54,7 +53,7 @@ def find_in_lines(lines: List[str], cmd: str, help: str) -> bool:
5453
pytest.param(["pets", "list"], False, id="pets-list"),
5554
],
5655
)
57-
def test_subcommands_help(args: List[str], expected: bool):
56+
def test_subcommands_help(args: list[str], expected: bool):
5857
full_args = (
5958
[sys.executable, "-m", "coverage", "run", str(SUBCOMMANDS)] + args + ["--help"]
6059
)
@@ -193,7 +192,7 @@ def test_subcommands_users_update_tree():
193192
pytest.param(["pets", "list"], "Need to compile list of pets", id="pets-list"),
194193
],
195194
)
196-
def test_subcommands_execute(args: List[str], message: str):
195+
def test_subcommands_execute(args: list[str], message: str):
197196
full_args = [sys.executable, "-m", "coverage", "run", str(SUBCOMMANDS)] + args
198197
result = subprocess.run(
199198
full_args,

typer/command_tree.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from gettext import gettext as _
3-
from typing import Any, Dict, List, Tuple
3+
from typing import Any
44

55
import click
66

@@ -14,8 +14,8 @@
1414

1515

1616
def _commands_from_info(
17-
info: Dict[str, Any], indent_level: int
18-
) -> List[Tuple[str, str]]:
17+
info: dict[str, Any], indent_level: int
18+
) -> list[tuple[str, str]]:
1919
items = []
2020
subcommands = info.get("commands", {})
2121

typer/rich_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,10 +677,10 @@ def rich_format_help(
677677

678678
def rich_format_subcommands(
679679
ctx: click.Context,
680-
subcommands: List[Tuple[str, str]],
680+
subcommands: list[tuple[str, str]],
681681
) -> None:
682682
console = _get_rich_console()
683-
t_styles: Dict[str, Any] = {
683+
t_styles: dict[str, Any] = {
684684
"show_lines": STYLE_OPTIONS_TABLE_SHOW_LINES,
685685
"leading": STYLE_OPTIONS_TABLE_LEADING,
686686
"box": STYLE_OPTIONS_TABLE_BOX,

0 commit comments

Comments
 (0)