[3.13] gh-133117: Enable stricter mypy checks for `tomllib` (GH-133206) by miss-islington · Pull Request #133343 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Lib/tomllib/_parser.py
6 changes: 3 additions & 3 deletions Lib/tomllib/_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
)


def match_to_datetime(match: re.Match) -> datetime | date:
def match_to_datetime(match: re.Match[str]) -> datetime | date:
"""Convert a `RE_DATETIME` match to `datetime.datetime` or `datetime.date`.

Raises ValueError if the match does not correspond to a valid date
Expand Down Expand Up @@ -95,13 +95,13 @@ def cached_tz(hour_str: str, minute_str: str, sign_str: str) -> timezone:
)


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


def match_to_number(match: re.Match, parse_float: ParseFloat) -> Any:
def match_to_number(match: re.Match[str], parse_float: ParseFloat) -> Any:
if match.group("floatpart"):
return parse_float(match.group())
return int(match.group(), 0)
2 changes: 0 additions & 2 deletions Lib/tomllib/mypy.ini