MCPcopy Index your code
hub / github.com/python/cpython / _getargspec

Function _getargspec

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

Source from the content-addressed store, hash-verified

149 return '', '\n'.join(lines)
150
151def _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
172def classname(object, modname):
173 """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 4

signatureMethod · 0.45
formatMethod · 0.45
matchMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…