class_docstr: Extension of the completer class with IPython-specific features
class_docstr_tok: ["Extension","of","the","completer","class","with","IPython-specific","features"]
docstr: Match magics
docstr_tok: ["Match","magics"]
code: def magic_matches(self, text):
      """Match magics"""
      # Get all shell magics now rather than statically, so magics loaded at
      # runtime show up too.
      lsm = self.shell.magics_manager.lsmagic()
      line_magics = lsm["line"]
      cell_magics = lsm["cell"]
      pre = self.magic_escape
      pre2 = pre + pre
  
      # Completion logic:
      # - user gives %%: only do cell magics
      # - user gives %: do both line and cell magics
      # - no prefix: do both
      # In other words, line magics are skipped if the user gives %% explicitly
      bare_text = text.lstrip(pre)
      comp = [pre2 + m for m in cell_magics if m.startswith(bare_text)]
      if not text.startswith(pre2):
          comp += [
              pre + m for m in line_magics if m.startswith(bare_text)
          ]
      return [cast_unicode_py2(c) for c in comp]
  
imports: from __future__ import print_function
  import __main__
  import glob
  import inspect
  import itertools
  import keyword
  import os
  import re
  import sys
  import unicodedata
  import string
  import warnings
  from traitlets.config.configurable import Configurable
  from IPython.core.error import TryNext
  from IPython.core.inputsplitter import ESC_MAGIC
  from IPython.core.latex_symbols import latex_symbols, reverse_latex_symbol
  from IPython.utils import generics
  from IPython.utils.decorators import undoc
  from IPython.utils.dir2 import dir2, get_real_method
  from IPython.utils.process import arg_split
  from IPython.utils.py3compat import builtin_mod, string_types, PY3, cast_unicode_py2
  from traitlets import Bool, Enum, observe
label_desc: Use image node_id 8 for calling the IPCompleter obj's underlying member method code with example usage: obj.magic_matches(text) and returns: unknown