(rows: list[dict], schema: type[SchemaT] | Any)
| 114 | |
| 115 | |
| 116 | def _validate_rows(rows: list[dict], schema: type[SchemaT] | Any) -> list[SchemaT]: |
| 117 | if not _PYDANTIC_AVAILABLE: |
| 118 | return cast(list[SchemaT], rows) |
| 119 | |
| 120 | if _PydanticTypeAdapter is not None and isinstance(schema, _PydanticTypeAdapter): |
| 121 | return [cast(SchemaT, schema.validate_python(row)) for row in rows] |
| 122 | |
| 123 | if ( |
| 124 | _PydanticBaseModel is not None |
| 125 | and isinstance(schema, type) |
| 126 | and issubclass(schema, _PydanticBaseModel) |
| 127 | ): |
| 128 | return [cast(SchemaT, schema.model_validate(row)) for row in rows] |
| 129 | |
| 130 | return cast(list[SchemaT], rows) |
no outgoing calls
no test coverage detected
searching dependent graphs…