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='')
| 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. |