MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / lists_in

Function lists_in

tests/test_open_telemetry.py:8279–8286  ·  view source on GitHub ↗

The list types among the members of a union.

(tp: Any)

Source from the content-addressed store, hash-verified

8277
8278
8279def lists_in(tp: Any) -> list[Any]:
8280 """The list types among the members of a union."""
8281 origin = get_origin(tp)
8282 if origin in (Annotated, Required, NotRequired):
8283 return lists_in(get_args(tp)[0])
8284 if origin in (Union, UnionType):
8285 return [found for arg in get_args(tp) for found in lists_in(arg)]
8286 return [tp] if origin in (list, Iterable, Sequence) else []
8287
8288
8289def result_blocks(*unions: Any) -> list[Any]:

Calls 2

get_originFunction · 0.50
get_argsFunction · 0.50

Tested by

no test coverage detected