MCPcopy Create free account
hub / github.com/ipython/ipython / lsmagic_docs

Method lsmagic_docs

IPython/core/magic.py:353–375  ·  view source on GitHub ↗

Return dict of documentation of magic functions. The return dict has the keys 'line' and 'cell', corresponding to the two types of magics we support. Each value is a dict keyed by magic name whose value is the function docstring. If a docstring is unavailable, the va

(self, brief=False, missing='')

Source from the content-addressed store, hash-verified

351 return self.magics
352
353 def lsmagic_docs(self, brief=False, missing=''):
354 """Return dict of documentation of magic functions.
355
356 The return dict has the keys 'line' and 'cell', corresponding to the
357 two types of magics we support. Each value is a dict keyed by magic
358 name whose value is the function docstring. If a docstring is
359 unavailable, the value of `missing` is used instead.
360
361 If brief is True, only the first line of each docstring will be returned.
362 """
363 docs = {}
364 for m_type in self.magics:
365 m_docs = {}
366 for m_name, m_func in self.magics[m_type].items():
367 if m_func.__doc__:
368 if brief:
369 m_docs[m_name] = m_func.__doc__.split('\n', 1)[0]
370 else:
371 m_docs[m_name] = m_func.__doc__.rstrip()
372 else:
373 m_docs[m_name] = missing
374 docs[m_type] = m_docs
375 return docs
376
377 def register(self, *magic_objects):
378 """Register one or more instances of Magics.

Callers 1

_magic_docsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected