Show More
@@ -480,12 +480,15 b' class Inspector:' | |||||
480 |
|
480 | |||
481 | # The fields to be displayed by pinfo: (fancy_name, key_in_info_dict) |
|
481 | # The fields to be displayed by pinfo: (fancy_name, key_in_info_dict) | |
482 | pinfo_fields1 = [("Type", "type_name"), |
|
482 | pinfo_fields1 = [("Type", "type_name"), | |
483 | ("Base Class", "base_class"), |
|
483 | ] | |
484 | ("String Form", "string_form"), |
|
484 | ||
485 | ("Namespace", "namespace"), |
|
485 | pinfo_fields2 = [("String Form", "string_form"), | |
486 |
|
|
486 | ] | |
|
487 | ||||
|
488 | pinfo_fields3 = [("Length", "length"), | |||
487 | ("File", "file"), |
|
489 | ("File", "file"), | |
488 |
("Definition", "definition") |
|
490 | ("Definition", "definition"), | |
|
491 | ] | |||
489 |
|
492 | |||
490 | pinfo_fields_obj = [("Class Docstring", "class_docstring"), |
|
493 | pinfo_fields_obj = [("Class Docstring", "class_docstring"), | |
491 | ("Constructor Docstring","init_docstring"), |
|
494 | ("Constructor Docstring","init_docstring"), | |
@@ -509,11 +512,26 b' class Inspector:' | |||||
509 | info = self.info(obj, oname=oname, formatter=formatter, |
|
512 | info = self.info(obj, oname=oname, formatter=formatter, | |
510 | info=info, detail_level=detail_level) |
|
513 | info=info, detail_level=detail_level) | |
511 | displayfields = [] |
|
514 | displayfields = [] | |
512 | for title, key in self.pinfo_fields1: |
|
515 | def add_fields(fields): | |
513 | field = info[key] |
|
516 | for title, key in fields: | |
514 |
|
|
517 | field = info[key] | |
515 | displayfields.append((title, field.rstrip())) |
|
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 | # Source or docstring, depending on detail level and whether |
|
535 | # Source or docstring, depending on detail level and whether | |
518 | # source found. |
|
536 | # source found. | |
519 | if detail_level > 0 and info['source'] is not None: |
|
537 | if detail_level > 0 and info['source'] is not None: | |
@@ -534,10 +552,7 b' class Inspector:' | |||||
534 |
|
552 | |||
535 | # Info for objects: |
|
553 | # Info for objects: | |
536 | else: |
|
554 | else: | |
537 |
|
|
555 | add_fields(self.pinfo_fields_obj) | |
538 | field = info[key] |
|
|||
539 | if field is not None: |
|
|||
540 | displayfields.append((title, field.rstrip())) |
|
|||
541 |
|
556 | |||
542 | # Finally send to printer/pager: |
|
557 | # Finally send to printer/pager: | |
543 | if displayfields: |
|
558 | if displayfields: |
General Comments 0
You need to be logged in to leave comments.
Login now