gh-133117: Enable stricter mypy checks for `tomllib` (#133206) · python/cpython@cb31741 · GitHub
Skip to content

Commit cb31741

Browse files
authored
gh-133117: Enable stricter mypy checks for tomllib (#133206)
1 parent 1550c30 commit cb31741

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

Lib/tomllib/_parser.py

Lines changed: 5 additions & 5 deletions

Lib/tomllib/_re.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
)
5353

5454

55-
def match_to_datetime(match: re.Match) -> datetime | date:
55+
def match_to_datetime(match: re.Match[str]) -> datetime | date:
5656
"""Convert a `RE_DATETIME` match to `datetime.datetime` or `datetime.date`.
5757
5858
Raises ValueError if the match does not correspond to a valid date
@@ -101,13 +101,13 @@ def cached_tz(hour_str: str, minute_str: str, sign_str: str) -> timezone:
101101
)
102102

103103

104-
def match_to_localtime(match: re.Match) -> time:
104+
def match_to_localtime(match: re.Match[str]) -> time:
105105
hour_str, minute_str, sec_str, micros_str = match.groups()
106106
micros = int(micros_str.ljust(6, "0")) if micros_str else 0
107107
return time(int(hour_str), int(minute_str), int(sec_str), micros)
108108

109109

110-
def match_to_number(match: re.Match, parse_float: ParseFloat) -> Any:
110+
def match_to_number(match: re.Match[str], parse_float: ParseFloat) -> Any:
111111
if match.group("floatpart"):
112112
return parse_float(match.group())
113113
return int(match.group(), 0)

Lib/tomllib/mypy.ini

Lines changed: 0 additions & 2 deletions

0 commit comments

Comments
 (0)