Skip to content

Commit 176099d

Browse files
authored
Fix typing deprecation (#48)
1 parent 1adb13c commit 176099d

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

.github/pages/make_switcher.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,27 @@
33
from argparse import ArgumentParser
44
from pathlib import Path
55
from subprocess import CalledProcessError, check_output
6-
from typing import List, Optional
76

87

9-
def report_output(stdout: bytes, label: str) -> List[str]:
8+
def report_output(stdout: bytes, label: str) -> list[str]:
109
ret = stdout.decode().strip().split("\n")
1110
print(f"{label}: {ret}")
1211
return ret
1312

1413

15-
def get_branch_contents(ref: str) -> List[str]:
14+
def get_branch_contents(ref: str) -> list[str]:
1615
"""Get the list of directories in a branch."""
1716
stdout = check_output(["git", "ls-tree", "-d", "--name-only", ref])
1817
return report_output(stdout, "Branch contents")
1918

2019

21-
def get_sorted_tags_list() -> List[str]:
20+
def get_sorted_tags_list() -> list[str]:
2221
"""Get a list of sorted tags in descending order from the repository."""
2322
stdout = check_output(["git", "tag", "-l", "--sort=-v:refname"])
2423
return report_output(stdout, "Tags list")
2524

2625

27-
def get_versions(ref: str, add: Optional[str]) -> List[str]:
26+
def get_versions(ref: str, add: str | None) -> list[str]:
2827
"""Generate the file containing the list of all GitHub Pages builds."""
2928
# Get the directories (i.e. builds) from the GitHub Pages branch
3029
try:
@@ -41,7 +40,7 @@ def get_versions(ref: str, add: Optional[str]) -> List[str]:
4140
tags = get_sorted_tags_list()
4241

4342
# Make the sorted versions list from main branches and tags
44-
versions: List[str] = []
43+
versions: list[str] = []
4544
for version in ["master", "main"] + tags:
4645
if version in builds:
4746
versions.append(version)

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ repos:
1515
language: system
1616
entry: ruff check --force-exclude
1717
types: [python]
18+
exclude: ^.github/pages
1819
require_serial: true
1920

2021
- id: ruff-format
2122
name: format with ruff
2223
language: system
2324
entry: ruff format --force-exclude
25+
exclude: ^.github/pages
2426
types: [python]
2527
require_serial: true
2628

src/daq_config_server/beamline_parameters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from logging import Logger
2-
from typing import Any, Tuple, cast
2+
from typing import Any, cast
33

44
LOGGER = Logger(__name__)
55
BEAMLINE_PARAMETER_KEYWORDS = ["FB", "FULL", "deadtime"]
@@ -30,7 +30,7 @@ def from_lines(cls, file_name: str, config_lines: list[str]):
3030
for line in config_lines_nocomments
3131
]
3232
config_pairs: list[tuple[str, Any]] = [
33-
cast(Tuple[str, Any], param)
33+
cast(tuple[str, Any], param)
3434
for param in config_lines_sep_key_and_value
3535
if len(param) == 2
3636
]

0 commit comments

Comments
 (0)