Skip to content

Commit 5855820

Browse files
committed
fix: correct pygments token import usage
Generated-by: aiautocommit
1 parent 2bc9125 commit 5855820

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ipython_suggestions.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from collections import defaultdict
1818
from threading import Thread
1919
from inspect import isclass
20-
from pygments import Token
20+
from pygments import token
2121

2222
from IPython.utils import PyColorize
2323
from IPython import get_ipython
@@ -203,6 +203,11 @@ def findsymbol(arg):
203203
def suggestion(arg):
204204
global _symbols_last
205205
args = parse_argstring(suggestion, arg)
206+
207+
if not _symbols_last:
208+
print("No suggestions available.")
209+
return
210+
206211
if -len(_symbols_last) < args.suggestion_index < len(_symbols_last):
207212
method, line = _symbols_last[args.suggestion_index]
208213
if method == "exec":
@@ -214,7 +219,7 @@ def suggestion(arg):
214219
pass
215220
print(
216221
PyColorize.theme_table[shell.colors].format(
217-
[Token.Number, f"Suggestions: {line}"]
222+
[(token.Number, f"Suggestions: {line}")]
218223
)
219224
)
220225
# print(

0 commit comments

Comments
 (0)