File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed
Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,10 @@ by adding ``c.Completer.use_jedi = False`` to the ``ipython_config.py`` file.
101101Changelog
102102---------
103103
104+ next
105+ ~~~~
106+ - Fix compatibility with IPython 9's new theme system.
107+
104108v0.5
105109~~~~
106110- Avoid erroring when exiting IPython≥8.15.
Original file line number Diff line number Diff line change @@ -89,9 +89,16 @@ def _report(ipython, msg):
8989 sys .stdout ._raw = True
9090 except AttributeError :
9191 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 ))
92+ if IPython .version_info >= (9 ,):
93+ import pygments # Only a dependency from IPython 4.2.0.
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