MCPcopy Index your code
hub / github.com/RustPython/RustPython / _getargspec

Function _getargspec

Lib/pydoc.py:216–235  ·  view source on GitHub ↗
(object)

Source from the content-addressed store, hash-verified

214 return '', '\n'.join(lines)
215
216def _getargspec(object):
217 try:
218 signature = inspect.signature(object, annotation_format=Format.STRING)
219 if signature:
220 name = getattr(object, '__name__', '')
221 # <lambda> function are always single-line and should not be formatted
222 max_width = (80 - len(name)) if name != '<lambda>' else None
223 return signature.format(max_width=max_width, quote_annotation_strings=False)
224 except (ValueError, TypeError):
225 argspec = getattr(object, '__text_signature__', None)
226 if argspec:
227 if argspec[:2] == '($':
228 argspec = '(' + argspec[2:]
229 if getattr(object, '__self__', None) is not None:
230 # Strip the bound argument.
231 m = re.match(r'\(\w+(?:(?=\))|,\s*(?:/(?:(?=\))|,\s*))?)', argspec)
232 if m:
233 argspec = '(' + argspec[m.end():]
234 return argspec
235 return None
236
237def classname(object, modname):
238 """Get a class name and qualify it with a module name if necessary."""

Callers 4

docclassMethod · 0.85
docroutineMethod · 0.85
docclassMethod · 0.85
docroutineMethod · 0.85

Calls 6

getattrFunction · 0.85
lenFunction · 0.85
signatureMethod · 0.45
formatMethod · 0.45
matchMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected