(*, field: ModelField, value: Any)
| 364 | |
| 365 | |
| 366 | def serialize_sequence_value(*, field: ModelField, value: Any) -> Sequence[Any]: |
| 367 | origin_type = get_origin(field.field_info.annotation) or field.field_info.annotation |
| 368 | if origin_type is Union or origin_type is UnionType: # Handle optional sequences |
| 369 | union_args = get_args(field.field_info.annotation) |
| 370 | for union_arg in union_args: |
| 371 | if union_arg is type(None): |
| 372 | continue |
| 373 | origin_type = get_origin(union_arg) or union_arg |
| 374 | break |
| 375 | assert issubclass(origin_type, shared.sequence_types) # type: ignore[arg-type] # ty: ignore[invalid-argument-type] |
| 376 | return shared.sequence_annotation_to_type[origin_type](value) # type: ignore[no-any-return,index] # ty: ignore[invalid-return-type] |
| 377 | |
| 378 | |
| 379 | def get_missing_field_error(loc: tuple[int | str, ...]) -> dict[str, Any]: |
no outgoing calls
no test coverage detected