def merge_plugins()

in src/databao_context_engine/plugins/plugin_loader.py [0:0]


def merge_plugins(*plugin_lists: list[BuildPlugin]) -> PluginList:
    """
    Merge multiple plugin maps
    """
    registry: PluginList = {}
    for plugins in plugin_lists:
        for plugin in plugins:
            for full_type in plugin.supported_types():
                datasource_type = DatasourceType(full_type=full_type)
                if datasource_type in registry:
                    raise DuplicatePluginTypeError(
                        f"Plugin type '{datasource_type.full_type}' is provided by both {type(registry[datasource_type]).__name__} and {type(plugin).__name__}"
                    )
                registry[datasource_type] = plugin
    return registry