Cleanup: update use of typing in for Python scripts

This commit is contained in:
Campbell Barton
2024-10-23 12:48:09 +11:00
parent 39b9863cca
commit a0453ab87a
40 changed files with 287 additions and 367 deletions

View File

@@ -8,16 +8,13 @@ import os
import subprocess
import sys
from typing import (
Dict,
Generator,
Optional,
from collections.abc import (
Iterator,
Sequence,
Tuple,
)
def run(cmd: Sequence[str], *, env: Optional[Dict[str, str]] = None) -> None:
def run(cmd: Sequence[str], *, env: dict[str, str] | None = None) -> None:
print(" ", " ".join(cmd))
subprocess.check_call(cmd, env=env)
@@ -61,7 +58,7 @@ icons_blend = (
)
def names_and_time_from_path(path: str) -> Generator[Tuple[str, float], None, None]:
def names_and_time_from_path(path: str) -> Iterator[tuple[str, float]]:
for entry in os.scandir(path):
name = entry.name
if name.endswith(".dat"):