|
40 | 40 | from types import ModuleType |
41 | 41 |
|
42 | 42 | from pygments.token import Token |
| 43 | +from pygments.lexers import Python3Lexer |
43 | 44 |
|
44 | 45 | from . import autocomplete |
45 | 46 | from . import inspection |
46 | | -from ._py3compat import PythonLexer, py3, prepare_for_exec |
| 47 | +from ._py3compat import py3, prepare_for_exec |
47 | 48 | from .clipboard import get_clipboard, CopyFailed |
48 | 49 | from .config import getpreferredencoding |
49 | 50 | from .formatter import Parenthesis |
@@ -572,7 +573,7 @@ def _funcname_and_argnum(cls, line): |
572 | 573 | # argument so we're done counting |
573 | 574 | stack = [["", "", 0, ""]] |
574 | 575 | try: |
575 | | - for (token, value) in PythonLexer().get_tokens(line): |
| 576 | + for (token, value) in Python3Lexer().get_tokens(line): |
576 | 577 | if token is Token.Punctuation: |
577 | 578 | if value in "([{": |
578 | 579 | stack.append(["", "", 0, value]) |
@@ -1079,7 +1080,7 @@ def tokenize(self, s, newline=False): |
1079 | 1080 | if self.cpos: |
1080 | 1081 | cursor += 1 |
1081 | 1082 | stack = list() |
1082 | | - all_tokens = list(PythonLexer().get_tokens(source)) |
| 1083 | + all_tokens = list(Python3Lexer().get_tokens(source)) |
1083 | 1084 | # Unfortunately, Pygments adds a trailing newline and strings with |
1084 | 1085 | # no size, so strip them |
1085 | 1086 | while not all_tokens[-1][1]: |
@@ -1250,7 +1251,7 @@ def next_indentation(line, tab_length): |
1250 | 1251 | def next_token_inside_string(code_string, inside_string): |
1251 | 1252 | """Given a code string s and an initial state inside_string, return |
1252 | 1253 | whether the next token will be inside a string or not.""" |
1253 | | - for token, value in PythonLexer().get_tokens(code_string): |
| 1254 | + for token, value in Python3Lexer().get_tokens(code_string): |
1254 | 1255 | if token is Token.String: |
1255 | 1256 | value = value.lstrip("bBrRuU") |
1256 | 1257 | if value in ['"""', "'''", '"', "'"]: |
|
0 commit comments