##// END OF EJS Templates
Reduce unhelpful information shown by pinfo
Thomas Kluyver -
Show More
@@ -480,12 +480,15 b' class Inspector:'
480 480
481 481 # The fields to be displayed by pinfo: (fancy_name, key_in_info_dict)
482 482 pinfo_fields1 = [("Type", "type_name"),
483 ("Base Class", "base_class"),
484 ("String Form", "string_form"),
485 ("Namespace", "namespace"),
486 ("Length", "length"),
483 ]
484
485 pinfo_fields2 = [("String Form", "string_form"),
486 ]
487
488 pinfo_fields3 = [("Length", "length"),
487 489 ("File", "file"),
488 ("Definition", "definition")]
490 ("Definition", "definition"),
491 ]
489 492
490 493 pinfo_fields_obj = [("Class Docstring", "class_docstring"),
491 494 ("Constructor Docstring","init_docstring"),
@@ -509,11 +512,26 b' class Inspector:'
509 512 info = self.info(obj, oname=oname, formatter=formatter,
510 513 info=info, detail_level=detail_level)
511 514 displayfields = []
512 for title, key in self.pinfo_fields1:
513 field = info[key]
514 if field is not None:
515 displayfields.append((title, field.rstrip()))
515 def add_fields(fields):
516 for title, key in fields:
517 field = info[key]
518 if field is not None:
519 displayfields.append((title, field.rstrip()))
520
521 add_fields(self.pinfo_fields1)
522
523 # Base class for old-style instances
524 if (not py3compat.PY3) and isinstance(obj, types.InstanceType) and info['base_class']:
525 displayfield.append(("Base Class", info['base_class'].rstrip()))
526
527 add_fields(self.pinfo_fields2)
528
529 # Namespace
530 if info['namespace'] != 'Interactive':
531 displayfield.append(("Namespace", info['namespace'].rstrip()))
516 532
533 add_fields(self.pinfo_fields3)
534
517 535 # Source or docstring, depending on detail level and whether
518 536 # source found.
519 537 if detail_level > 0 and info['source'] is not None:
@@ -534,10 +552,7 b' class Inspector:'
534 552
535 553 # Info for objects:
536 554 else:
537 for title, key in self.pinfo_fields_obj:
538 field = info[key]
539 if field is not None:
540 displayfields.append((title, field.rstrip()))
555 add_fields(self.pinfo_fields_obj)
541 556
542 557 # Finally send to printer/pager:
543 558 if displayfields:
General Comments 0
You need to be logged in to leave comments. Login now