MCPcopy
hub / github.com/beetbox/beets / types

Function types

beets/plugins.py:503–517  ·  view source on GitHub ↗

Return mapping between flex field names and types for the given model.

(model_cls: type[AnyModel])

Source from the content-addressed store, hash-verified

501
502
503def 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
520def named_queries(model_cls: type[AnyModel]) -> dict[str, FieldQueryType]:

Callers

nothing calls this directly

Calls 3

find_pluginsFunction · 0.85
PluginConflictErrorClass · 0.85
updateMethod · 0.45

Tested by

no test coverage detected