MCPcopy Create free account
hub / github.com/streamlit/streamlit / annotate_raises

Function annotate_raises

lib/tests/testutil.py:170–177  ·  view source on GitHub ↗

Annotate function that raises NameError like PEP 649 with undefined types.

(format: Format)

Source from the content-addressed store, hash-verified

168 from annotationlib import Format, ForwardRef
169
170 def annotate_raises(format: Format) -> dict[str, object]:
171 """Annotate function that raises NameError like PEP 649 with undefined types."""
172 if format == Format.VALUE:
173 raise NameError("name 'UndefinedType' is not defined")
174 if format == Format.STRING:
175 return string_annotations
176 # FORWARDREF format
177 return {k: ForwardRef(v) for k, v in string_annotations.items()}
178
179 func = types.FunctionType(
180 base_func.__code__, # type: ignore[union-attr]

Callers

nothing calls this directly

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…