File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121:license: Python License.
2222"""
2323from _ast import *
24- lazy import re
25- lazy import sys
2624lazy from _colorize import can_colorize , get_theme
2725
2826
@@ -352,6 +350,8 @@ def _splitlines_no_ff(source, maxlines=None):
352350 """
353351 global _line_pattern
354352 if _line_pattern is None :
353+ # lazily computed to speedup import time of `ast`
354+ import re
355355 _line_pattern = re .compile (r"(.*?(?:\r\n|\n|\r|$))" )
356356
357357 lines = []
@@ -653,6 +653,7 @@ def unparse(ast_obj):
653653
654654def main (args = None ):
655655 import argparse
656+ import sys
656657
657658 parser = argparse .ArgumentParser (color = True )
658659 parser .add_argument ('infile' , nargs = '?' , default = '-' ,
Original file line number Diff line number Diff line change @@ -3680,7 +3680,6 @@ def test_show_empty_flag(self):
36803680 self .check_output (source , expect , '--show-empty' )
36813681
36823682
3683- @support .force_not_colorized_test_class
36843683class ASTOptimizationTests (unittest .TestCase ):
36853684 def wrap_expr (self , expr ):
36863685 return ast .Module (body = [ast .Expr (value = expr )])
You can’t perform that action at this time.
0 commit comments