##// END OF EJS Templates
Merge pull request #13343 from fasiha/blocklist-for-info...
Matthias Bussonnier -
r27188:6d0095d2 merge
parent child Browse files
Show More
@@ -1699,7 +1699,7 b' class InteractiveShell(SingletonConfigurable):'
1699 1699 """Get object info as formatted text"""
1700 1700 return self.object_inspect_mime(oname, detail_level)['text/plain']
1701 1701
1702 def object_inspect_mime(self, oname, detail_level=0):
1702 def object_inspect_mime(self, oname, detail_level=0, omit_sections=()):
1703 1703 """Get object info as a mimebundle of formatted representations.
1704 1704
1705 1705 A mimebundle is a dictionary, keyed by mime-type.
@@ -1715,6 +1715,7 b' class InteractiveShell(SingletonConfigurable):'
1715 1715 info=info,
1716 1716 detail_level=detail_level,
1717 1717 formatter=docformat,
1718 omit_sections=omit_sections,
1718 1719 )
1719 1720 else:
1720 1721 raise KeyError(oname)
@@ -566,7 +566,9 b' class Inspector(Colorable):'
566 566 bundle['text/plain'] = text
567 567 return bundle
568 568
569 def _get_info(self, obj, oname='', formatter=None, info=None, detail_level=0):
569 def _get_info(
570 self, obj, oname="", formatter=None, info=None, detail_level=0, omit_sections=()
571 ):
570 572 """Retrieve an info dict and format it.
571 573
572 574 Parameters
@@ -581,6 +583,8 b' class Inspector(Colorable):'
581 583 already computed information
582 584 detail_level: integer
583 585 Granularity of detail level, if set to 1, give more information.
586 omit_sections: container[str]
587 Titles or keys to omit from output (can be set, tuple, etc., anything supporting `in`)
584 588 """
585 589
586 590 info = self._info(obj, oname=oname, info=info, detail_level=detail_level)
@@ -591,6 +595,8 b' class Inspector(Colorable):'
591 595 }
592 596
593 597 def append_field(bundle, title:str, key:str, formatter=None):
598 if title in omit_sections or key in omit_sections:
599 return
594 600 field = info[key]
595 601 if field is not None:
596 602 formatted_field = self._mime_format(field, formatter)
@@ -655,7 +661,16 b' class Inspector(Colorable):'
655 661
656 662 return self.format_mime(_mime)
657 663
658 def pinfo(self, obj, oname='', formatter=None, info=None, detail_level=0, enable_html_pager=True):
664 def pinfo(
665 self,
666 obj,
667 oname="",
668 formatter=None,
669 info=None,
670 detail_level=0,
671 enable_html_pager=True,
672 omit_sections=(),
673 ):
659 674 """Show detailed information about an object.
660 675
661 676 Optional arguments:
@@ -676,8 +691,12 b' class Inspector(Colorable):'
676 691 precomputed already.
677 692
678 693 - detail_level: if set to 1, more information is given.
694
695 - omit_sections: set of section keys and titles to omit
679 696 """
680 info = self._get_info(obj, oname, formatter, info, detail_level)
697 info = self._get_info(
698 obj, oname, formatter, info, detail_level, omit_sections=omit_sections
699 )
681 700 if not enable_html_pager:
682 701 del info['text/html']
683 702 page.page(info)
General Comments 0
You need to be logged in to leave comments. Login now