MCPcopy Index your code
hub / github.com/fastapi/sqlmodel / is_field_noneable

Function is_field_noneable

sqlmodel/_compat.py:157–171  ·  view source on GitHub ↗
(field: "FieldInfo")

Source from the content-addressed store, hash-verified

155
156
157def is_field_noneable(field: "FieldInfo") -> bool:
158 if getattr(field, "nullable", Undefined) is not Undefined:
159 return field.nullable # type: ignore
160 origin = get_origin(field.annotation)
161 if origin is not None and _is_union_type(origin):
162 args = get_args(field.annotation)
163 if any(arg is NoneType for arg in args):
164 return True
165 if not field.is_required():
166 if field.default is Undefined:
167 return False
168 if field.annotation is None or field.annotation is NoneType:
169 return True
170 return False
171 return False
172
173
174def get_sa_type_from_type_annotation(annotation: Any) -> Any:

Callers 1

get_column_from_fieldFunction · 0.85

Calls 1

_is_union_typeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…