Skip to content

Commit

Permalink
Update parser.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer authored Feb 12, 2023
1 parent 81f9f73 commit 7e04c40
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions invoke/parser/parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import copy
from typing import Any, Iterable, List, Optional, overload
from typing import TYPE_CHECKING, Any, Iterable, List, Optional, overload

try:
from ..vendor.lexicon import Lexicon
Expand All @@ -8,10 +8,12 @@
from lexicon import Lexicon # type: ignore[no-redef]
from fluidity import StateMachine, state, transition # type: ignore[no-redef]

from .context import ParserContext
from ..exceptions import ParseError
from ..util import debug

if TYPE_CHECKING:
from .context import ParserContext


def is_flag(value: str) -> bool:
return value.startswith("-")
Expand All @@ -21,7 +23,7 @@ def is_long_flag(value: str) -> bool:
return value.startswith("--")


class ParseResult(List[ParserContext]):
class ParseResult(List["ParserContext"]):
"""
List-like object with some extra parse-related attributes.
Expand All @@ -36,9 +38,9 @@ class ParseResult(List[ParserContext]):
def __init__(self) -> None:
...
@overload
def __init__(self, iterable: Iterable[ParserContext], /):
def __init__(self, iterable: Iterable["ParserContext"], /):
...
def __init__(self, iterable: Optional[Iterable[ParserContext]] = None, /): # type: ignore[misc]
def __init__(self, iterable: Optional[Iterable["ParserContext"]] = None, /): # type: ignore[misc]
if iterable is None:
super().__init__()
else:
Expand Down

0 comments on commit 7e04c40

Please sign in to comment.