MCPcopy Create free account
hub / github.com/OpenRouterTeam/python-sdk / is_nullable

Function is_nullable

src/openrouter/utils/serializers.py:154–166  ·  view source on GitHub ↗
(field)

Source from the content-addressed store, hash-verified

152
153
154def is_nullable(field):
155 origin = get_origin(field)
156 if origin is Nullable or origin is OptionalNullable:
157 return True
158
159 if not origin is Union or type(None) not in get_args(field):
160 return False
161
162 for arg in get_args(field):
163 if get_origin(arg) is Nullable or get_origin(arg) is OptionalNullable:
164 return True
165
166 return False
167
168
169def is_union(obj: object) -> bool:

Callers 1

marshal_jsonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected