This is a development version (latest) and may be unstable.Go to latest (9.17.0)
{ } Raw JSON

bundles / IPython latest / IPython / utils / PyColorize / _exec_pygments_style_module

function

IPython.utils.PyColorize:_exec_pygments_style_module

source: /IPython/utils/PyColorize.py:44

Signature

def _exec_pygments_style_module(module: str, class_name: str) → Any | None

Summary

Read one style's styles mapping out of pygments/styles/<module>.py.

Extended Summary

Returns None if pygments is not laid out as expected, leaving it to the caller to fall back to pygments.styles.get_style_by_name.

The module is executed in isolation and deliberately not registered in sys.modules: registering a submodule of a package that is not itself imported breaks later import pygments.styles.<module> statements, and keeping pygments.styles unimported is the entire point. Style modules are pure data, so executing one twice is harmless, and nothing but the styles dict escapes this function.

Aliases

  • IPython.utils.PyColorize._exec_pygments_style_module