Return mapping between flex field names and types for the given model.
(model_cls: type[AnyModel])
| 501 | |
| 502 | |
| 503 | def types(model_cls: type[AnyModel]) -> dict[str, Type]: |
| 504 | """Return mapping between flex field names and types for the given model.""" |
| 505 | attr_name = f"{model_cls.__name__.lower()}_types" |
| 506 | types: dict[str, Type] = {} |
| 507 | for plugin in find_plugins(): |
| 508 | plugin_types = getattr(plugin, attr_name, {}) |
| 509 | for field in plugin_types: |
| 510 | if field in types and plugin_types[field] != types[field]: |
| 511 | raise PluginConflictError( |
| 512 | f"Plugin {plugin.name} defines flexible field {field} " |
| 513 | "which has already been defined with " |
| 514 | "another type." |
| 515 | ) |
| 516 | types.update(plugin_types) |
| 517 | return types |
| 518 | |
| 519 | |
| 520 | def named_queries(model_cls: type[AnyModel]) -> dict[str, FieldQueryType]: |
nothing calls this directly
no test coverage detected