Show More
@@ -1502,6 +1502,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1502 | 1502 | return 'not found' # so callers can take other action |
|
1503 | 1503 | |
|
1504 | 1504 | def object_inspect(self, oname, detail_level=0): |
|
1505 | """Get object info about oname""" | |
|
1505 | 1506 | with self.builtin_trap: |
|
1506 | 1507 | info = self._object_find(oname) |
|
1507 | 1508 | if info.found: |
@@ -1511,6 +1512,17 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1511 | 1512 | else: |
|
1512 | 1513 | return oinspect.object_info(name=oname, found=False) |
|
1513 | 1514 | |
|
1515 | def object_inspect_text(self, oname, detail_level=0): | |
|
1516 | """Get object info as formatted text""" | |
|
1517 | with self.builtin_trap: | |
|
1518 | info = self._object_find(oname) | |
|
1519 | if info.found: | |
|
1520 | return self.inspector._format_info(info.obj, oname, info=info, | |
|
1521 | detail_level=detail_level | |
|
1522 | ) | |
|
1523 | else: | |
|
1524 | raise KeyError(oname) | |
|
1525 | ||
|
1514 | 1526 | #------------------------------------------------------------------------- |
|
1515 | 1527 | # Things related to history management |
|
1516 | 1528 | #------------------------------------------------------------------------- |
@@ -7,12 +7,9 b' Similar in spirit to the inspect module, but all calls take a name argument to' | |||
|
7 | 7 | reference the name under which an object is being read. |
|
8 | 8 | """ |
|
9 | 9 | |
|
10 | #***************************************************************************** | |
|
11 | # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu> | |
|
12 | # | |
|
13 | # Distributed under the terms of the BSD License. The full license is in | |
|
14 | # the file COPYING, distributed as part of this software. | |
|
15 | #***************************************************************************** | |
|
10 | # Copyright (c) IPython Development Team. | |
|
11 | # Distributed under the terms of the Modified BSD License. | |
|
12 | ||
|
16 | 13 | from __future__ import print_function |
|
17 | 14 | |
|
18 | 15 | __all__ = ['Inspector','InspectColors'] |
@@ -532,21 +529,9 b' class Inspector:' | |||
|
532 | 529 | ("Init docstring", "init_docstring"), |
|
533 | 530 | ("Call def", "call_def"), |
|
534 | 531 | ("Call docstring", "call_docstring")] |
|
535 | ||
|
536 |
def |
|
|
537 | """Show detailed information about an object. | |
|
538 | ||
|
539 | Optional arguments: | |
|
540 | ||
|
541 | - oname: name of the variable pointing to the object. | |
|
542 | ||
|
543 | - formatter: special formatter for docstrings (see pdoc) | |
|
544 | ||
|
545 | - info: a structure with some information fields which may have been | |
|
546 | precomputed already. | |
|
547 | ||
|
548 | - detail_level: if set to 1, more information is given. | |
|
549 | """ | |
|
532 | ||
|
533 | def _format_info(self, obj, oname='', formatter=None, info=None, detail_level=0): | |
|
534 | """Format an info dict as text""" | |
|
550 | 535 | info = self.info(obj, oname=oname, formatter=formatter, |
|
551 | 536 | info=info, detail_level=detail_level) |
|
552 | 537 | displayfields = [] |
@@ -590,11 +575,30 b' class Inspector:' | |||
|
590 | 575 | # Info for objects: |
|
591 | 576 | else: |
|
592 | 577 | add_fields(self.pinfo_fields_obj) |
|
593 | ||
|
594 | # Finally send to printer/pager: | |
|
578 | ||
|
595 | 579 | if displayfields: |
|
596 |
|
|
|
580 | return self._format_fields(displayfields) | |
|
581 | else: | |
|
582 | return u'' | |
|
583 | ||
|
584 | def pinfo(self, obj, oname='', formatter=None, info=None, detail_level=0): | |
|
585 | """Show detailed information about an object. | |
|
586 | ||
|
587 | Optional arguments: | |
|
588 | ||
|
589 | - oname: name of the variable pointing to the object. | |
|
597 | 590 |
|
|
591 | - formatter: special formatter for docstrings (see pdoc) | |
|
592 | ||
|
593 | - info: a structure with some information fields which may have been | |
|
594 | precomputed already. | |
|
595 | ||
|
596 | - detail_level: if set to 1, more information is given. | |
|
597 | """ | |
|
598 | text = self._format_info(obj, oname, formatter, info, detail_level) | |
|
599 | if text: | |
|
600 | page.page(text) | |
|
601 | ||
|
598 | 602 | def info(self, obj, oname='', formatter=None, info=None, detail_level=0): |
|
599 | 603 | """Compute a dict with detailed information about an object. |
|
600 | 604 |
General Comments 0
You need to be logged in to leave comments.
Login now