-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Py runtime: Move to relative imports #4705
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
from antlr4.Token import Token | ||
from antlr4.InputStream import InputStream | ||
from antlr4.FileStream import FileStream | ||
from antlr4.StdinStream import StdinStream | ||
from antlr4.BufferedTokenStream import TokenStream | ||
from antlr4.CommonTokenStream import CommonTokenStream | ||
from antlr4.Lexer import Lexer | ||
from antlr4.Parser import Parser | ||
from antlr4.dfa.DFA import DFA | ||
from antlr4.atn.ATN import ATN | ||
from antlr4.atn.ATNDeserializer import ATNDeserializer | ||
from antlr4.atn.LexerATNSimulator import LexerATNSimulator | ||
from antlr4.atn.ParserATNSimulator import ParserATNSimulator | ||
from antlr4.atn.PredictionMode import PredictionMode | ||
from antlr4.PredictionContext import PredictionContextCache | ||
from antlr4.ParserRuleContext import RuleContext, ParserRuleContext | ||
from antlr4.tree.Tree import ParseTreeListener, ParseTreeVisitor, ParseTreeWalker, TerminalNode, ErrorNode, RuleNode | ||
from antlr4.error.Errors import RecognitionException, IllegalStateException, NoViableAltException | ||
from antlr4.error.ErrorStrategy import BailErrorStrategy | ||
from antlr4.error.DiagnosticErrorListener import DiagnosticErrorListener | ||
from antlr4.Utils import str_list | ||
from .Token import Token | ||
from .InputStream import InputStream | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future I would recommend making these explicit export based imports, as mentioned in https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-no-implicit-reexport. I didn't do that here because I would try to add some validation of this expectation. |
||
from .FileStream import FileStream | ||
from .StdinStream import StdinStream | ||
from .BufferedTokenStream import TokenStream | ||
from .CommonTokenStream import CommonTokenStream | ||
from .Lexer import Lexer | ||
from .Parser import Parser | ||
from .dfa.DFA import DFA | ||
from .atn.ATN import ATN | ||
from .atn.ATNDeserializer import ATNDeserializer | ||
from .atn.LexerATNSimulator import LexerATNSimulator | ||
from .atn.ParserATNSimulator import ParserATNSimulator | ||
from .atn.PredictionMode import PredictionMode | ||
from .PredictionContext import PredictionContextCache | ||
from .ParserRuleContext import RuleContext, ParserRuleContext | ||
from .tree.Tree import ParseTreeListener, ParseTreeVisitor, ParseTreeWalker, TerminalNode, ErrorNode, RuleNode | ||
from .error.Errors import RecognitionException, IllegalStateException, NoViableAltException | ||
from .error.ErrorStrategy import BailErrorStrategy | ||
from .error.DiagnosticErrorListener import DiagnosticErrorListener | ||
from .Utils import str_list |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
#!python | ||
__author__ = 'jszheng' | ||
import optparse | ||
import sys | ||
import os | ||
import importlib | ||
from antlr4 import * | ||
|
||
from . import * | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only place where |
||
|
||
# this is a python version of TestRig | ||
|
@@ -165,7 +164,3 @@ def process(input_stream, class_lexer, class_parser): | |
process(input_stream, class_lexer, class_parser) | ||
else: | ||
print("[ERROR] file {} not exist".format(os.path.normpath(file_name))) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing that the reason these imports were made lazy was because of circular import issues... This MR should start to straighten that out.