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

Method lsmagic_docs

IPython/core/magic.py:428–452  ·  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: bool = False, missing: str = ""
    )

Source from the content-addressed store, hash-verified

426 return self.magics
427
428 def lsmagic_docs(
429 self, brief: bool = False, missing: str = ""
430 ) -> dict[str, dict[str, str]]:
431 """Return dict of documentation of magic functions.
432
433 The return dict has the keys 'line' and 'cell', corresponding to the
434 two types of magics we support. Each value is a dict keyed by magic
435 name whose value is the function docstring. If a docstring is
436 unavailable, the value of `missing` is used instead.
437
438 If brief is True, only the first line of each docstring will be returned.
439 """
440 docs: dict[str, dict[str, str]] = {}
441 for m_type in self.magics:
442 m_docs: dict[str, str] = {}
443 for m_name, m_func in self.magics[m_type].items():
444 if m_func.__doc__:
445 if brief:
446 m_docs[m_name] = m_func.__doc__.split("\n", 1)[0]
447 else:
448 m_docs[m_name] = m_func.__doc__.rstrip()
449 else:
450 m_docs[m_name] = missing
451 docs[m_type] = m_docs
452 return docs
453
454 def register_lazy(self, name: str, fully_qualified_name: str) -> None:
455 """

Callers 1

_magic_docsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected