Show More
@@ -442,17 +442,17 class Inspector: | |||||
442 | if formatter: |
|
442 | if formatter: | |
443 | ds = formatter(ds) |
|
443 | ds = formatter(ds) | |
444 | if ds: |
|
444 | if ds: | |
445 |
lines.append(head("Class |
|
445 | lines.append(head("Class docstring:")) | |
446 | lines.append(indent(ds)) |
|
446 | lines.append(indent(ds)) | |
447 | if inspect.isclass(obj) and hasattr(obj, '__init__'): |
|
447 | if inspect.isclass(obj) and hasattr(obj, '__init__'): | |
448 | init_ds = getdoc(obj.__init__) |
|
448 | init_ds = getdoc(obj.__init__) | |
449 | if init_ds is not None: |
|
449 | if init_ds is not None: | |
450 |
lines.append(head("Init |
|
450 | lines.append(head("Init docstring:")) | |
451 | lines.append(indent(init_ds)) |
|
451 | lines.append(indent(init_ds)) | |
452 | elif hasattr(obj,'__call__'): |
|
452 | elif hasattr(obj,'__call__'): | |
453 | call_ds = getdoc(obj.__call__) |
|
453 | call_ds = getdoc(obj.__call__) | |
454 | if call_ds: |
|
454 | if call_ds: | |
455 |
lines.append(head("Call |
|
455 | lines.append(head("Call docstring:")) | |
456 | lines.append(indent(call_ds)) |
|
456 | lines.append(indent(call_ds)) | |
457 |
|
457 | |||
458 | if not lines: |
|
458 | if not lines: | |
@@ -521,7 +521,7 class Inspector: | |||||
521 | pinfo_fields1 = [("Type", "type_name"), |
|
521 | pinfo_fields1 = [("Type", "type_name"), | |
522 | ] |
|
522 | ] | |
523 |
|
523 | |||
524 |
pinfo_fields2 = [("String |
|
524 | pinfo_fields2 = [("String form", "string_form"), | |
525 | ] |
|
525 | ] | |
526 |
|
526 | |||
527 | pinfo_fields3 = [("Length", "length"), |
|
527 | pinfo_fields3 = [("Length", "length"), | |
@@ -529,8 +529,8 class Inspector: | |||||
529 | ("Definition", "definition"), |
|
529 | ("Definition", "definition"), | |
530 | ] |
|
530 | ] | |
531 |
|
531 | |||
532 |
pinfo_fields_obj = [("Class |
|
532 | pinfo_fields_obj = [("Class docstring", "class_docstring"), | |
533 |
("Init |
|
533 | ("Init docstring", "init_docstring"), | |
534 | ("Call def", "call_def"), |
|
534 | ("Call def", "call_def"), | |
535 | ("Call docstring", "call_docstring")] |
|
535 | ("Call docstring", "call_docstring")] | |
536 |
|
536 | |||
@@ -571,7 +571,7 class Inspector: | |||||
571 |
|
571 | |||
572 | add_fields(self.pinfo_fields3) |
|
572 | add_fields(self.pinfo_fields3) | |
573 | if info['isclass'] and info['init_definition']: |
|
573 | if info['isclass'] and info['init_definition']: | |
574 |
displayfields.append(("Init |
|
574 | displayfields.append(("Init definition", | |
575 | info['init_definition'].rstrip())) |
|
575 | info['init_definition'].rstrip())) | |
576 |
|
576 | |||
577 | # Source or docstring, depending on detail level and whether |
|
577 | # Source or docstring, depending on detail level and whether | |
@@ -585,7 +585,7 class Inspector: | |||||
585 | # Constructor info for classes |
|
585 | # Constructor info for classes | |
586 | if info['isclass']: |
|
586 | if info['isclass']: | |
587 | if info['init_docstring'] is not None: |
|
587 | if info['init_docstring'] is not None: | |
588 |
displayfields.append(("Init |
|
588 | displayfields.append(("Init docstring", | |
589 | info['init_docstring'])) |
|
589 | info['init_docstring'])) | |
590 |
|
590 | |||
591 | # Info for objects: |
|
591 | # Info for objects: |
@@ -114,16 +114,16 def test_ipdb_magics(): | |||||
114 | ipdb> pdef example_function |
|
114 | ipdb> pdef example_function | |
115 | example_function(x, y, z='hello') |
|
115 | example_function(x, y, z='hello') | |
116 | ipdb> pdoc ExampleClass |
|
116 | ipdb> pdoc ExampleClass | |
117 |
Class |
|
117 | Class docstring: | |
118 | Docstring for ExampleClass. |
|
118 | Docstring for ExampleClass. | |
119 |
Init |
|
119 | Init docstring: | |
120 | Docstring for ExampleClass.__init__ |
|
120 | Docstring for ExampleClass.__init__ | |
121 | ipdb> pinfo a |
|
121 | ipdb> pinfo a | |
122 | Type: ExampleClass |
|
122 | Type: ExampleClass | |
123 |
String |
|
123 | String form: ExampleClass() | |
124 | Namespace: Local... |
|
124 | Namespace: Local... | |
125 | Docstring: Docstring for ExampleClass. |
|
125 | Docstring: Docstring for ExampleClass. | |
126 |
Init |
|
126 | Init docstring: Docstring for ExampleClass.__init__ | |
127 | ipdb> continue |
|
127 | ipdb> continue | |
128 |
|
128 | |||
129 | Restore previous trace function, e.g. for coverage.py |
|
129 | Restore previous trace function, e.g. for coverage.py |
General Comments 0
You need to be logged in to leave comments.
Login now