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

Function extra_info

scripts/whats_left.py:112–139  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

110
111
112def extra_info(obj):
113 if callable(obj) and not inspect._signature_is_builtin(obj):
114 doc = inspect.getdoc(obj)
115 try:
116 sig = str(inspect.signature(obj))
117 # remove function memory addresses
118 return {
119 "sig": re.sub(" at 0x[0-9A-Fa-f]+", " at 0xdeadbeef", sig),
120 "doc": doc,
121 }
122 except Exception as e:
123 exception = repr(e)
124 # CPython uses ' RustPython uses "
125 if exception.replace('"', "'").startswith("ValueError('no signature found"):
126 return {
127 "sig": "ValueError('no signature found')",
128 "doc": doc,
129 }
130
131 return {
132 "sig": exception,
133 "doc": doc,
134 }
135
136 return {
137 "sig": None,
138 "doc": None,
139 }
140
141
142def name_sort_key(name):

Callers 3

gen_methodsFunction · 0.85
dir_of_mod_or_errorFunction · 0.85

Calls 7

callableFunction · 0.85
strFunction · 0.85
reprFunction · 0.85
signatureMethod · 0.45
subMethod · 0.45
startswithMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected