class_docstr: Syntax highlighter for the Python language.
      
class_docstr_tok: ["Syntax","highlighter","for","the","Python","language","."]
code: def __init__(self, document):
      super().__init__(document)
  
      # Multi-line strings (expression, flag, style)
      self.tri_single = (QRegularExpression("'''"), 1, "string2")
      self.tri_double = (QRegularExpression('"""'), 2, "string2")
  
      rules = []
  
      # Keyword, operator, and brace rules
      rules += [
          (r"\b%s\b" % w, 0, "keyword")
          for w in PythonHighlighter.keywords
      ]
      rules += [(o, 0, "operator") for o in PythonHighlighter.operators]
      rules += [(b, 0, "brace") for b in PythonHighlighter.braces]
  
      # All other rules
      rules += [
          # 'self'
          (r"\bself\b", 0, "self"),
          # 'def' followed by an identifier
          (r"\bdef\b\s*(\w+)", 1, "defclass"),
          # 'class' followed by an identifier
          (r"\bclass\b\s*(\w+)", 1, "defclass"),
          # Numeric literals
          (r"\b[+-]?[0-9]+[lL]?\b", 0, "numbers"),
          (r"\b[+-]?0[xX][0-9A-Fa-f]+[lL]?\b", 0, "numbers"),
          (
              r"\b[+-]?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\b",
              0,
              "numbers",
          ),
          # Double-quoted string, possibly containing escape sequences
          (r'"[^"\\]*(\\.[^"\\]*)*"', 0, "string"),
          # Single-quoted string, possibly containing escape sequences
          (r"'[^'\\]*(\\.[^'\\]*)*'", 0, "string"),
          # From '#' until a newline
          (r"#[^\n]*", 0, "comment"),
      ]
      self.rules = rules
      self.searchText = None
  
imports: import keyword
  import os
  import pkgutil
  import re
  import subprocess
  import sys
  from argparse import Namespace
  from collections import OrderedDict
  from functools import lru_cache
  import pyqtgraph
  from pyqtgraph.Qt import QT_LIB, QtCore, QtGui, QtWidgets
  import exampleLoaderTemplate_generic
  import utils
label_desc: Use image node_id 1 to create a new PythonHighlighter object from inherited base classes: QSyntaxHighlighter with example: obj = PythonHighlighter(document)