(*schemas: type[Schema])
| 157 | |
| 158 | |
| 159 | def schema_add(*schemas: type[Schema]) -> type[Schema]: |
| 160 | # TODO: we are dropping properties here |
| 161 | annots_list = [get_type_hints(schema) for schema in schemas] |
| 162 | annotations = dict(ChainMap(*annots_list)) |
| 163 | |
| 164 | assert len(annotations) == sum([len(annots) for annots in annots_list]) |
| 165 | |
| 166 | fields_list = [_cls_fields(schema) for schema in schemas] |
| 167 | fields = dict(ChainMap(*fields_list)) |
| 168 | |
| 169 | assert len(fields) == sum([len(f) for f in fields_list]) |
| 170 | |
| 171 | # TODO: id_dtype should be an LCA od all id_types |
| 172 | |
| 173 | return _schema_builder( |
| 174 | "_".join(schema.__name__ for schema in schemas), |
| 175 | { |
| 176 | "__metaclass__": SchemaMetaclass, |
| 177 | "__annotations__": annotations, |
| 178 | "__orig__": {f"__arg{i}__": arg for i, arg in enumerate(schemas)}, |
| 179 | **fields, |
| 180 | }, |
| 181 | ) |
| 182 | |
| 183 | |
| 184 | def _create_column_definitions( |
no test coverage detected