Skip to content

Commit 7e04c40

Browse files
Update parser.py
1 parent 81f9f73 commit 7e04c40

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

invoke/parser/parser.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import copy
2-
from typing import Any, Iterable, List, Optional, overload
2+
from typing import TYPE_CHECKING, Any, Iterable, List, Optional, overload
33

44
try:
55
from ..vendor.lexicon import Lexicon
@@ -8,10 +8,12 @@
88
from lexicon import Lexicon # type: ignore[no-redef]
99
from fluidity import StateMachine, state, transition # type: ignore[no-redef]
1010

11-
from .context import ParserContext
1211
from ..exceptions import ParseError
1312
from ..util import debug
1413

14+
if TYPE_CHECKING:
15+
from .context import ParserContext
16+
1517

1618
def is_flag(value: str) -> bool:
1719
return value.startswith("-")
@@ -21,7 +23,7 @@ def is_long_flag(value: str) -> bool:
2123
return value.startswith("--")
2224

2325

24-
class ParseResult(List[ParserContext]):
26+
class ParseResult(List["ParserContext"]):
2527
"""
2628
List-like object with some extra parse-related attributes.
2729
@@ -36,9 +38,9 @@ class ParseResult(List[ParserContext]):
3638
def __init__(self) -> None:
3739
...
3840
@overload
39-
def __init__(self, iterable: Iterable[ParserContext], /):
41+
def __init__(self, iterable: Iterable["ParserContext"], /):
4042
...
41-
def __init__(self, iterable: Optional[Iterable[ParserContext]] = None, /): # type: ignore[misc]
43+
def __init__(self, iterable: Optional[Iterable["ParserContext"]] = None, /): # type: ignore[misc]
4244
if iterable is None:
4345
super().__init__()
4446
else:

0 commit comments

Comments
 (0)