(object)
| 149 | return '', '\n'.join(lines) |
| 150 | |
| 151 | def _getargspec(object): |
| 152 | try: |
| 153 | signature = inspect.signature(object, annotation_format=Format.STRING) |
| 154 | if signature: |
| 155 | name = getattr(object, '__name__', '') |
| 156 | # <lambda> function are always single-line and should not be formatted |
| 157 | max_width = (80 - len(name)) if name != '<lambda>' else None |
| 158 | return signature.format(max_width=max_width, quote_annotation_strings=False) |
| 159 | except (ValueError, TypeError): |
| 160 | argspec = getattr(object, '__text_signature__', None) |
| 161 | if argspec: |
| 162 | if argspec[:2] == '($': |
| 163 | argspec = '(' + argspec[2:] |
| 164 | if getattr(object, '__self__', None) is not None: |
| 165 | # Strip the bound argument. |
| 166 | m = re.match(r'\(\w+(?:(?=\))|,\s*(?:/(?:(?=\))|,\s*))?)', argspec) |
| 167 | if m: |
| 168 | argspec = '(' + argspec[m.end():] |
| 169 | return argspec |
| 170 | return None |
| 171 | |
| 172 | def classname(object, modname): |
| 173 | """Get a class name and qualify it with a module name if necessary.""" |
no test coverage detected
searching dependent graphs…