Skip to content

Commit 7ba100e

Browse files
committed
Mypy tests fixes
1 parent 680d1c9 commit 7ba100e

File tree

8 files changed

+14
-16
lines changed

8 files changed

+14
-16
lines changed

stubs/antlr4-python3-runtime/antlr4/CommonTokenFactory.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from antlr4 import InputStream
1+
from antlr4.InputStream import InputStream
22
from antlr4.Lexer import TokenSource
33
from antlr4.Token import CommonToken as CommonToken
44

stubs/antlr4-python3-runtime/antlr4/Parser.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from typing import Literal, TextIO
33

44
from antlr4.atn.ATNDeserializationOptions import ATNDeserializationOptions as ATNDeserializationOptions
55
from antlr4.atn.ATNDeserializer import ATNDeserializer as ATNDeserializer
6+
from antlr4.atn.ParserATNSimulator import ParserATNSimulator
67
from antlr4.BufferedTokenStream import TokenStream as TokenStream
78
from antlr4.CommonTokenFactory import TokenFactory as TokenFactory
89
from antlr4.error.Errors import (
@@ -12,7 +13,6 @@ from antlr4.error.Errors import (
1213
from antlr4.error.ErrorStrategy import DefaultErrorStrategy as DefaultErrorStrategy
1314
from antlr4.InputStream import InputStream as InputStream
1415
from antlr4.Lexer import Lexer as Lexer
15-
from antlr4.ParserInterpreter import ParserInterpreter
1616
from antlr4.ParserRuleContext import ParserRuleContext as ParserRuleContext
1717
from antlr4.Recognizer import Recognizer as Recognizer
1818
from antlr4.RuleContext import RuleContext as RuleContext
@@ -49,7 +49,7 @@ class Parser(Recognizer):
4949
_tracer: TraceListener | None
5050
_parseListeners: list[ParseTreeListener]
5151
_syntaxErrors: int
52-
_interp: ParserInterpreter
52+
_interp: ParserATNSimulator
5353
bypassAltsAtnCache: dict[Incomplete, Incomplete]
5454
buildParseTrees: bool
5555
def __init__(self, input: TokenStream, output: TextIO = ...) -> None: ...

stubs/antlr4-python3-runtime/antlr4/ParserInterpreter.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class ParserInterpreter(Parser):
3535
decisionToDFA: list[DFA]
3636
sharedContextCache: PredictionContextCache
3737
pushRecursionContextStates: set[int]
38-
_interp: ParserATNSimulator
3938
def __init__(
4039
self, grammarFileName: str, tokenNames: list[str], ruleNames: list[str], atn: ATN, input: TokenStream
4140
) -> None: ...

stubs/antlr4-python3-runtime/antlr4/ParserRuleContext.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import Callable, Generator
2-
from typing import Literal, TypeVar
2+
from typing import TypeVar
33

44
from antlr4.error.Errors import RecognitionException
55
from antlr4.RuleContext import RuleContext as RuleContext
@@ -38,7 +38,7 @@ class ParserRuleContext(RuleContext):
3838
def getTypedRuleContext(self, ctxType: type[ParserRuleContextT], i: int) -> ParserRuleContextT | None: ...
3939
def getTypedRuleContexts(self, ctxType: type[ParserRuleContextT]) -> list[ParserRuleContextT]: ...
4040
def getChildCount(self) -> int: ...
41-
def getSourceInterval(self) -> tuple[Literal[-1], Literal[-2]] | tuple[int | None, int | None]: ...
41+
def getSourceInterval(self) -> tuple[int | None, int | None]: ...
4242

4343
GenericType = TypeVar("GenericType", bound=type)
4444
ParseTreeT = TypeVar("ParseTreeT", bound=ParseTree)

stubs/antlr4-python3-runtime/antlr4/Recognizer.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from _typeshed import Incomplete
2-
from typing import Literal
32

43
from antlr4.atn.ATNSimulator import ATNSimulator
54
from antlr4.error.ErrorListener import (
@@ -30,8 +29,8 @@ class Recognizer:
3029
def getErrorHeader(self, e: RecognitionException) -> str: ...
3130
def getTokenErrorDisplay(self, t: Token | None) -> str: ...
3231
def getErrorListenerDispatch(self) -> ProxyErrorListener: ...
33-
def sempred(self, localctx: RuleContext, ruleIndex: int, actionIndex: int) -> Literal[True]: ...
34-
def precpred(self, localctx: RuleContext, precedence: int) -> Literal[True]: ...
32+
def sempred(self, localctx: RuleContext, ruleIndex: int, actionIndex: int) -> bool: ...
33+
def precpred(self, localctx: RuleContext, precedence: int) -> bool: ...
3534
@property
3635
def state(self) -> int: ...
3736
@state.setter

stubs/antlr4-python3-runtime/antlr4/RuleContext.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import Generator
2-
from typing import Literal, Self
2+
from typing import Any, Literal, Self
33

44
from antlr4.Recognizer import Recognizer as Parser
55
from antlr4.tree.Tree import INVALID_INTERVAL as INVALID_INTERVAL, ParseTreeVisitor as ParseTreeVisitor, RuleNode as RuleNode
@@ -13,16 +13,16 @@ class RuleContext(RuleNode):
1313
def __init__(self, parent: RuleContext | None = None, invokingState: int = -1) -> None: ...
1414
def depth(self) -> int: ...
1515
def isEmpty(self) -> bool: ...
16-
def getSourceInterval(self) -> tuple[Literal[-1], Literal[-2]]: ...
16+
def getSourceInterval(self) -> tuple[int | None, int | None]: ...
1717
def getRuleContext(self) -> Self: ...
1818
def getPayload(self) -> Self: ...
1919
def getText(self) -> str: ...
2020
def getRuleIndex(self) -> Literal[-1]: ...
2121
def getAltNumber(self) -> Literal[0]: ...
2222
def setAltNumber(self, altNumber: int) -> None: ...
23-
def getChild(self, i: int) -> None: ...
24-
def getChildCount(self) -> Literal[0]: ...
25-
def getChildren(self) -> Generator[None, None, None]: ...
23+
def getChild(self, i: int) -> Any: ...
24+
def getChildCount(self) -> int: ...
25+
def getChildren(self) -> Generator[Any, None, None]: ...
2626
def accept(self, visitor: ParseTreeVisitor) -> None: ...
2727
def toStringTree(self, ruleNames: list[str] | None = None, recog: Parser | None = None) -> str: ...
2828
def toString(self, ruleNames: list[str], stop: RuleContext) -> str: ...

stubs/antlr4-python3-runtime/antlr4/Token.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from antlr4 import InputStream
1+
from antlr4.InputStream import InputStream
22
from antlr4.Lexer import TokenSource
33

44
class Token:

stubs/antlr4-python3-runtime/antlr4/tree/Tree.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from _typeshed import Incomplete
22
from typing import Any, Literal, TypeVar
33

4-
from antlr4 import ParserRuleContext, RuleContext
4+
from antlr4.ParserRuleContext import ParserRuleContext, RuleContext
55
from antlr4.Token import Token as Token
66

77
INVALID_INTERVAL: Incomplete

0 commit comments

Comments
 (0)