(annotation, base_module=None)
| 1435 | return ArgInfo(args, varargs, varkw, frame.f_locals) |
| 1436 | |
| 1437 | def formatannotation(annotation, base_module=None): |
| 1438 | if getattr(annotation, '__module__', None) == 'typing': |
| 1439 | def repl(match): |
| 1440 | text = match.group() |
| 1441 | return text.removeprefix('typing.') |
| 1442 | return re.sub(r'[\w\.]+', repl, repr(annotation)) |
| 1443 | if isinstance(annotation, types.GenericAlias): |
| 1444 | return str(annotation) |
| 1445 | if isinstance(annotation, type): |
| 1446 | if annotation.__module__ in ('builtins', base_module): |
| 1447 | return annotation.__qualname__ |
| 1448 | return annotation.__module__+'.'+annotation.__qualname__ |
| 1449 | return repr(annotation) |
| 1450 | |
| 1451 | def formatannotationrelativeto(object): |
| 1452 | module = getattr(object, '__module__', None) |
no test coverage detected