-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-export all public members for mypy (#119)
* Replace each import `x` in __init__.py with `x as x` * Run mypy on examples
- Loading branch information
Showing
6 changed files
with
94 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,35 @@ | ||
from .metaclasses import ParserContext, fwd | ||
# Use `as` to mark names as re-exports from submodules for mypy. | ||
# Remove this from all re-exports whenever mypy supports a less verbose solution | ||
# (https://github.com/python/mypy/issues/10198) | ||
# or Ruff adds adds an equivalent lint | ||
# (https://github.com/astral-sh/ruff/issues/13507) | ||
from .metaclasses import ParserContext as ParserContext, fwd as fwd | ||
from .parsers import ( | ||
Parser, | ||
any1, | ||
debug, | ||
eof, | ||
failure, | ||
first, | ||
lit, | ||
longest, | ||
opt, | ||
pred, | ||
reg, | ||
rep, | ||
rep1, | ||
rep1sep, | ||
repsep, | ||
success, | ||
until, | ||
Parser as Parser, | ||
any1 as any1, | ||
debug as debug, | ||
eof as eof, | ||
failure as failure, | ||
first as first, | ||
lit as lit, | ||
longest as longest, | ||
opt as opt, | ||
pred as pred, | ||
reg as reg, | ||
rep as rep, | ||
rep1 as rep1, | ||
rep1sep as rep1sep, | ||
repsep as repsep, | ||
success as success, | ||
until as until, | ||
) | ||
from .state import ( | ||
Failure, | ||
ParseError, | ||
Reader, | ||
RecursionError, | ||
Result, | ||
SequenceReader, | ||
StringReader, | ||
Success, | ||
Failure as Failure, | ||
ParseError as ParseError, | ||
Reader as Reader, | ||
RecursionError as RecursionError, | ||
Result as Result, | ||
SequenceReader as SequenceReader, | ||
StringReader as StringReader, | ||
Success as Success, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,43 @@ | ||
from ._alternative import FirstAlternativeParser, LongestAlternativeParser, first, longest | ||
from ._any import AnyParser, any1 | ||
from ._base import Parser, wrap_literal | ||
from ._conversion import ConversionParser, TransformationParser | ||
from ._debug import DebugParser, debug | ||
from ._end_of_source import EndOfSourceParser, eof | ||
from ._literal import LiteralParser, lit | ||
from ._optional import OptionalParser, opt | ||
from ._predicate import PredicateParser, pred | ||
from ._regex import RegexParser, reg | ||
from ._repeated import RepeatedOnceParser, RepeatedParser, rep, rep1 | ||
# Use `as` to mark names as re-exports from submodules for mypy. | ||
from ._alternative import ( | ||
FirstAlternativeParser as FirstAlternativeParser, | ||
LongestAlternativeParser as LongestAlternativeParser, | ||
first as first, | ||
longest as longest, | ||
) | ||
from ._any import AnyParser as AnyParser, any1 as any1 | ||
from ._base import Parser as Parser, wrap_literal as wrap_literal | ||
from ._conversion import ( | ||
ConversionParser as ConversionParser, | ||
TransformationParser as TransformationParser, | ||
) | ||
from ._debug import DebugParser as DebugParser, debug as debug | ||
from ._end_of_source import EndOfSourceParser as EndOfSourceParser, eof as eof | ||
from ._literal import LiteralParser as LiteralParser, lit as lit | ||
from ._optional import OptionalParser as OptionalParser, opt as opt | ||
from ._predicate import PredicateParser as PredicateParser, pred as pred | ||
from ._regex import RegexParser as RegexParser, reg as reg | ||
from ._repeated import ( | ||
RepeatedOnceParser as RepeatedOnceParser, | ||
RepeatedParser as RepeatedParser, | ||
rep as rep, | ||
rep1 as rep1, | ||
) | ||
from ._repeated_seperated import ( | ||
RepeatedOnceSeparatedParser, | ||
RepeatedSeparatedParser, | ||
rep1sep, | ||
repsep, | ||
RepeatedOnceSeparatedParser as RepeatedOnceSeparatedParser, | ||
RepeatedSeparatedParser as RepeatedSeparatedParser, | ||
rep1sep as rep1sep, | ||
repsep as repsep, | ||
) | ||
from ._sequential import ( | ||
DiscardLeftParser as DiscardLeftParser, | ||
DiscardRightParser as DiscardRightParser, | ||
SequentialParser as SequentialParser, | ||
) | ||
from ._success import ( | ||
FailureParser as FailureParser, | ||
SuccessParser as SuccessParser, | ||
failure as failure, | ||
success as success, | ||
) | ||
from ._sequential import DiscardLeftParser, DiscardRightParser, SequentialParser | ||
from ._success import FailureParser, SuccessParser, failure, success | ||
from ._until import UntilParser, until | ||
from ._until import UntilParser as UntilParser, until as until |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
from ._exceptions import ParseError, RecursionError | ||
from ._reader import Reader, SequenceReader, StringReader | ||
from ._result import Failure, Result, Success | ||
from ._state import Continue, Element, Input, Output, State | ||
# Use `as` to mark names as re-exports from submodules for mypy. | ||
from ._exceptions import ParseError as ParseError, RecursionError as RecursionError | ||
from ._reader import ( | ||
Reader as Reader, | ||
SequenceReader as SequenceReader, | ||
StringReader as StringReader, | ||
) | ||
from ._result import Failure as Failure, Result as Result, Success as Success | ||
from ._state import ( | ||
Continue as Continue, | ||
Element as Element, | ||
Input as Input, | ||
Output as Output, | ||
State as State, | ||
) |