Skip to content

Commit 639e005

Browse files
Move textwrap import to the top
1 parent 8fc1349 commit 639e005

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Tools/c-analyzer/c_parser/parser/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@
116116
* alt impl using a state machine (& tokenizer or split on delimiters)
117117
"""
118118

119+
import textwrap
120+
119121
from ..info import ParsedItem
120122
from ._info import SourceInfo
121123

@@ -214,7 +216,6 @@ def _iter_source(lines, *, maxtext=11_000, maxlines=200, showtext=False):
214216
text = text[:500] + '...'
215217

216218
if srcinfo.too_much_text(maxtext):
217-
import textwrap
218219
msg = f'''
219220
too much text, try to increase MAX_SIZES[MAXTEXT] in cpython/_parser.py
220221
{filename} starting at line {lno_from} to {lno_to}
@@ -224,7 +225,6 @@ def _iter_source(lines, *, maxtext=11_000, maxlines=200, showtext=False):
224225
raise RuntimeError(textwrap.dedent(msg))
225226

226227
if srcinfo.too_many_lines(maxlines):
227-
import textwrap
228228
msg = f'''
229229
too many lines, try to increase MAX_SIZES[MAXLINES] in cpython/_parser.py
230230
{filename} starting at line {lno_from} to {lno_to}

0 commit comments

Comments
 (0)