(obj)
| 110 | |
| 111 | |
| 112 | def 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 | |
| 142 | def name_sort_key(name): |
no test coverage detected