MCPcopy
hub / github.com/pydantic/pydantic / NamespacesTuple

Class NamespacesTuple

pydantic/_internal/_namespace_utils.py:30–45  ·  view source on GitHub ↗

A tuple of globals and locals to be used during annotations evaluation. This datastructure is defined as a named tuple so that it can easily be unpacked: ```python {lint="skip" test="skip"} def eval_type(typ: type[Any], ns: NamespacesTuple) -> None: return eval(typ, *ns) ``

Source from the content-addressed store, hash-verified

28
29
30class NamespacesTuple(NamedTuple):
31 """A tuple of globals and locals to be used during annotations evaluation.
32
33 This datastructure is defined as a named tuple so that it can easily be unpacked:
34
35 ```python {lint="skip" test="skip"}
36 def eval_type(typ: type[Any], ns: NamespacesTuple) -> None:
37 return eval(typ, *ns)
38 ```
39 """
40
41 globals: GlobalsNamespace
42 """The namespace to be used as the `globals` argument during annotations evaluation."""
43
44 locals: MappingNamespace
45 """The namespace to be used as the `locals` argument during annotations evaluation."""
46
47
48def get_module_ns_of(obj: Any) -> dict[str, Any]:

Callers 3

ns_for_functionFunction · 0.85
__init__Method · 0.85
types_namespaceMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected