File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 2323 argument , magic_arguments , parse_argstring )
2424from IPython .core .magics .execution import ExecutionMagics
2525from IPython .utils import PyColorize
26+ import pygments
2627
2728try :
2829 import importlib .metadata as _im
@@ -89,9 +90,15 @@ def _report(ipython, msg):
8990 sys .stdout ._raw = True
9091 except AttributeError :
9192 pass
92- cs = PyColorize .Parser ().color_table [ipython .colors ].colors
93- # Token.NUMBER: bright blue (cyan), looks reasonable.
94- print ("{}Autoimport:{} {}" .format (cs [token .NUMBER ], cs ["normal" ], msg ))
93+ if IPython .version_info >= (9 ,):
94+ print (PyColorize .theme_table [ipython .colors ].format ([
95+ (pygments .token .Number , "Autoimport: " ),
96+ (pygments .token .Text , msg ),
97+ ]))
98+ else :
99+ cs = PyColorize .Parser ().color_table [ipython .colors ].colors
100+ # Token.NUMBER: bright blue (cyan), looks reasonable.
101+ print ("{}Autoimport:{} {}" .format (cs [token .NUMBER ], cs ["normal" ], msg ))
95102
96103
97104class _SubmoduleAutoImporterModule (ModuleType ):
You can’t perform that action at this time.
0 commit comments