MCPcopy
hub / github.com/pathwaycom/pathway / schema_add

Function schema_add

python/pathway/internals/schema.py:159–181  ·  view source on GitHub ↗
(*schemas: type[Schema])

Source from the content-addressed store, hash-verified

157
158
159def 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
184def _create_column_definitions(

Callers 1

__or__Method · 0.85

Calls 4

sumFunction · 0.85
_cls_fieldsFunction · 0.85
_schema_builderFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected