Show More
@@ -6,7 +6,7 b' Uses syntax highlighting for presenting the various information elements.' | |||||
6 | Similar in spirit to the inspect module, but all calls take a name argument to |
|
6 | Similar in spirit to the inspect module, but all calls take a name argument to | |
7 | reference the name under which an object is being read. |
|
7 | reference the name under which an object is being read. | |
8 |
|
8 | |||
9 |
$Id: OInspect.py 2 |
|
9 | $Id: OInspect.py 2558 2007-07-25 19:54:28Z fperez $ | |
10 | """ |
|
10 | """ | |
11 |
|
11 | |||
12 | #***************************************************************************** |
|
12 | #***************************************************************************** | |
@@ -467,6 +467,10 b' class Inspector:' | |||||
467 | # objects which use instance-customized docstrings. |
|
467 | # objects which use instance-customized docstrings. | |
468 | if ds: |
|
468 | if ds: | |
469 | class_ds = getdoc(obj.__class__) |
|
469 | class_ds = getdoc(obj.__class__) | |
|
470 | # Skip Python's auto-generated docstrings | |||
|
471 | if class_ds.startswith('function(code, globals[, name[,') or \ | |||
|
472 | class_ds.startswith('instancemethod(function, instance,'): | |||
|
473 | class_ds = None | |||
470 | if class_ds and ds != class_ds: |
|
474 | if class_ds and ds != class_ds: | |
471 | out.writeln(header('Class Docstring:\n') + |
|
475 | out.writeln(header('Class Docstring:\n') + | |
472 | indent(class_ds)) |
|
476 | indent(class_ds)) | |
@@ -474,6 +478,9 b' class Inspector:' | |||||
474 | # Next, try to show constructor docstrings |
|
478 | # Next, try to show constructor docstrings | |
475 | try: |
|
479 | try: | |
476 | init_ds = getdoc(obj.__init__) |
|
480 | init_ds = getdoc(obj.__init__) | |
|
481 | # Skip Python's auto-generated docstrings | |||
|
482 | if init_ds.startswith('x.__init__(...) initializes x'): | |||
|
483 | init_ds = None | |||
477 | except AttributeError: |
|
484 | except AttributeError: | |
478 | init_ds = None |
|
485 | init_ds = None | |
479 | if init_ds: |
|
486 | if init_ds: | |
@@ -482,14 +489,17 b' class Inspector:' | |||||
482 |
|
489 | |||
483 | # Call form docstring for callable instances |
|
490 | # Call form docstring for callable instances | |
484 | if hasattr(obj,'__call__'): |
|
491 | if hasattr(obj,'__call__'): | |
485 | out.writeln(header('Callable:\t')+'Yes') |
|
492 | #out.writeln(header('Callable:\t')+'Yes') | |
486 | call_def = self.__getdef(obj.__call__,oname) |
|
493 | call_def = self.__getdef(obj.__call__,oname) | |
487 | if call_def is None: |
|
494 | #if call_def is None: | |
488 | out.write(header('Call def:\t')+ |
|
495 | # out.writeln(header('Call def:\t')+ | |
489 | 'Calling definition not available.') |
|
496 | # 'Calling definition not available.') | |
490 |
|
|
497 | if call_def is not None: | |
491 | out.write(header('Call def:\t')+self.format(call_def)) |
|
498 | out.writeln(header('Call def:\t')+self.format(call_def)) | |
492 | call_ds = getdoc(obj.__call__) |
|
499 | call_ds = getdoc(obj.__call__) | |
|
500 | # Skip Python's auto-generated docstrings | |||
|
501 | if call_ds.startswith('x.__call__(...) <==> x(...)'): | |||
|
502 | call_ds = None | |||
493 | if call_ds: |
|
503 | if call_ds: | |
494 | out.writeln(header('Call docstring:\n') + indent(call_ds)) |
|
504 | out.writeln(header('Call docstring:\n') + indent(call_ds)) | |
495 |
|
505 |
@@ -1,3 +1,13 b'' | |||||
|
1 | 2007-07-25 Fernando Perez <Fernando.Perez@colorado.edu> | |||
|
2 | ||||
|
3 | * IPython/OInspect.py (Inspector.pinfo): fix small glitches in | |||
|
4 | 'foo?' and update the code to prevent printing of default | |||
|
5 | docstrings that started appearing after I added support for | |||
|
6 | new-style classes. The approach I'm using isn't ideal (I just | |||
|
7 | special-case those strings) but I'm not sure how to more robustly | |||
|
8 | differentiate between truly user-written strings and Python's | |||
|
9 | automatic ones. | |||
|
10 | ||||
1 | 2007-07-09 Ville Vainio <vivainio@gmail.com> |
|
11 | 2007-07-09 Ville Vainio <vivainio@gmail.com> | |
2 |
|
12 | |||
3 | * completer.py: Applied Matthew Neeley's patch: |
|
13 | * completer.py: Applied Matthew Neeley's patch: |
General Comments 0
You need to be logged in to leave comments.
Login now