MCPcopy Create free account
hub / github.com/pytest-dev/pytest / annotated_getattr

Function annotated_getattr

src/_pytest/monkeypatch.py:81–90  ·  view source on GitHub ↗
(obj: object, name: str, ann: str)

Source from the content-addressed store, hash-verified

79
80
81def annotated_getattr(obj: object, name: str, ann: str) -> object:
82 try:
83 obj = getattr(obj, name)
84 except AttributeError as e:
85 raise AttributeError(
86 "{!r} object at {} has no attribute {!r}".format(
87 type(obj).__name__, ann, name
88 )
89 ) from e
90 return obj
91
92
93def derive_importpath(import_path: str, raising: bool) -> Tuple[str, object]:

Callers 2

resolveFunction · 0.85
derive_importpathFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected