MCPcopy Index your code
hub / github.com/ipython/ipython / init_syntax_highlighting

Method init_syntax_highlighting

IPython/core/interactiveshell.py:806–830  ·  view source on GitHub ↗
(self, changes=None)

Source from the content-addressed store, hash-verified

804
805 @observe("colors")
806 def init_syntax_highlighting(self, changes=None):
807 # Python source parser/formatter for syntax highlighting
808 pyformat = PyColorize.Parser(theme_name=self.colors).format
809 self.pycolorize = lambda src: pyformat(src, "str")
810 if not hasattr(self, "inspector"):
811 self.inspector = self.inspector_class(
812 theme_name=self.colors,
813 str_detail_level=self.object_info_string_level,
814 parent=self,
815 )
816
817 try:
818 # Deprecation in 9.0, colors should always be lower
819 self.inspector.set_theme_name(self.colors.lower())
820 except Exception:
821 warn(
822 "Error changing object inspector color schemes.\n%s"
823 % (sys.exc_info()[1]),
824 stacklevel=2,
825 )
826 if hasattr(self, "InteractiveTB"):
827 self.InteractiveTB.set_theme_name(self.colors)
828 if hasattr(self, "SyntaxTB"):
829 self.SyntaxTB.set_theme_name(self.colors)
830 self.refresh_style()
831
832 def refresh_style(self):
833 # No-op here, used in subclass

Callers 1

__init__Method · 0.95

Calls 2

refresh_styleMethod · 0.95
set_theme_nameMethod · 0.45

Tested by

no test coverage detected