Skip to content

Commit

Permalink
fix pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLydike committed Jul 30, 2024
1 parent 214dcd9 commit 65cf06f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 5 additions & 3 deletions filecheck/error.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import re
from dataclasses import dataclass
from typing import Any
from typing import Any, TYPE_CHECKING

from filecheck.ops import CheckOp

if TYPE_CHECKING:
from filecheck.compiler import MatchT


class CheckError(Exception):
message: str
Expand All @@ -23,7 +25,7 @@ class ErrorOnMatch(Exception):

message: str
op: CheckOp
match: re.Match[str]
match: "MatchT"


@dataclass
Expand Down
7 changes: 3 additions & 4 deletions filecheck/matcher.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import re
import sys
from collections.abc import Sequence
from dataclasses import dataclass, field
from typing import Callable

from filecheck.compiler import compile_uops
from filecheck.compiler import compile_uops, MatchT
from filecheck.error import CheckError, ParseError, ErrorOnMatch
from filecheck.finput import FInput, InputRange
from filecheck.logging import warn
Expand Down Expand Up @@ -313,7 +312,7 @@ def purge_variables(self):

def capture_results(
self,
match: re.Match[str],
match: MatchT,
capture: dict[str, tuple[int, Callable[[str], int] | Callable[[str], str]]],
op: CheckOp,
):
Expand All @@ -332,7 +331,7 @@ def capture_results(
if self.opts.reject_empty_vars:
raise CheckError(f'Empty value captured for variable "{name}"', op)

def find_prefix_match_for(self, op: CheckOp) -> re.Match[str] | None:
def find_prefix_match_for(self, op: CheckOp) -> MatchT | None:
"""
Tries to construct a smaller pattern that matches a prefix of op.
Expand Down

0 comments on commit 65cf06f

Please sign in to comment.