Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix types
  • Loading branch information
StanFromIreland committed Dec 14, 2025
commit d58324de216ba131fc1959b4e4788584b8501a48
6 changes: 3 additions & 3 deletions Lib/_colorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,12 @@ class _Span(NamedTuple):
end: int

@classmethod
def from_re(cls, m: Match[str], group: int | str):
def from_re(cls, m: Match[str], group: int | str) -> "_Span":
Comment thread
StanFromIreland marked this conversation as resolved.
Outdated
re_span = m.span(group)
return cls(re_span[0], re_span[1] - 1)

@classmethod
def from_token(cls, token: TI, line_len: list[int]):
def from_token(cls, token: TI, line_len: list[int]) -> "_Span":
end_offset = -1
if (token.type in {T.FSTRING_MIDDLE, T.TSTRING_MIDDLE}
and token.string.endswith(("{", "}"))):
Expand All @@ -418,7 +418,7 @@ def from_token(cls, token: TI, line_len: list[int]):


class _ColorSpan(NamedTuple):
span: Span
span: _Span
tag: str


Expand Down
2 changes: 1 addition & 1 deletion Lib/_pyrepl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

# Re-export from _colorize for backward compatibility
gen_colors = _colorize._gen_colors
ColorSpam = _colorize._ColorSpan
ColorSpan = _colorize._ColorSpan
Span = _colorize._Span


Expand Down
Loading