Skip to content

Commit 1136a79

Browse files
style: add type parameters to re.Match annotations
1 parent 3aa1c0e commit 1136a79

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

codeflash/languages/javascript/instrument.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def transform(self, code: str) -> str:
191191
call_match = self._dot_call_pattern.search(code, pos)
192192

193193
# Choose the earliest match by position
194-
candidates: list[tuple[str, re.Match]] = []
194+
candidates: list[tuple[str, re.Match[str]]] = []
195195
if dot_match:
196196
candidates.append(("dot", dot_match))
197197
if bracket_match:
@@ -241,7 +241,7 @@ def transform(self, code: str) -> str:
241241

242242
return "".join(result)
243243

244-
def _should_skip_match(self, code: str, start: int, match: re.Match) -> bool:
244+
def _should_skip_match(self, code: str, start: int, match: re.Match[str]) -> bool:
245245
"""Check if the match should be skipped (inside expect, already transformed, etc.)."""
246246
# Skip if inside a string literal (e.g., test description)
247247
if is_inside_string(code, start):
@@ -325,7 +325,7 @@ def _find_matching_paren(self, code: str, open_paren_pos: int) -> int:
325325

326326
return pos if depth == 0 else -1
327327

328-
def _parse_standalone_call(self, code: str, match: re.Match) -> StandaloneCallMatch | None:
328+
def _parse_standalone_call(self, code: str, match: re.Match[str]) -> StandaloneCallMatch | None:
329329
"""Parse a complete standalone func(...) call."""
330330
leading_ws = match.group(1)
331331
prefix = match.group(2) or "" # "await " or ""
@@ -408,7 +408,7 @@ def _find_balanced_parens(self, code: str, open_paren_pos: int) -> tuple[str | N
408408
# slice once
409409
return s[open_paren_pos + 1 : pos - 1], pos
410410

411-
def _parse_bracket_standalone_call(self, code: str, match: re.Match) -> StandaloneCallMatch | None:
411+
def _parse_bracket_standalone_call(self, code: str, match: re.Match[str]) -> StandaloneCallMatch | None:
412412
"""Parse a complete standalone obj['func'](...) call with bracket notation."""
413413
leading_ws = match.group(1)
414414
prefix = match.group(2) or "" # "await " or ""
@@ -447,7 +447,7 @@ def _parse_bracket_standalone_call(self, code: str, match: re.Match) -> Standalo
447447
has_trailing_semicolon=has_trailing_semicolon,
448448
)
449449

450-
def _parse_dot_call_standalone(self, code: str, match: re.Match) -> StandaloneCallMatch | None:
450+
def _parse_dot_call_standalone(self, code: str, match: re.Match[str]) -> StandaloneCallMatch | None:
451451
"""Parse a funcName.call(thisArg, args) or obj.funcName.call(thisArg, args) call."""
452452
leading_ws = match.group(1)
453453
prefix = match.group(2) or "" # "await " or ""
@@ -655,7 +655,7 @@ def transform(self, code: str) -> str:
655655

656656
return "".join(result)
657657

658-
def _parse_expect_call(self, code: str, match: re.Match) -> ExpectCallMatch | None:
658+
def _parse_expect_call(self, code: str, match: re.Match[str]) -> ExpectCallMatch | None:
659659
"""Parse a complete expect(func(...)).assertion() call.
660660
661661
Returns None if the pattern doesn't match expected structure.
@@ -704,7 +704,7 @@ def _parse_expect_call(self, code: str, match: re.Match) -> ExpectCallMatch | No
704704
object_prefix=object_prefix,
705705
)
706706

707-
def _parse_expect_dot_call(self, code: str, match: re.Match) -> ExpectCallMatch | None:
707+
def _parse_expect_dot_call(self, code: str, match: re.Match[str]) -> ExpectCallMatch | None:
708708
"""Parse expect(funcName.call(thisArg, args)).assertion()."""
709709
leading_ws = match.group(1)
710710
object_prefix = match.group(2) or ""

0 commit comments

Comments
 (0)