pre-migration commit
This commit is contained in:
@@ -567,6 +567,15 @@ def list_search_plugins(config: Optional[Dict[str, Any]] = None) -> Dict[str, bo
|
||||
return availability
|
||||
|
||||
|
||||
def list_search_plugin_names() -> List[str]:
|
||||
"""Return registered search-provider names without instantiating plugins."""
|
||||
return sorted(
|
||||
info.canonical_name
|
||||
for info in REGISTRY.iter_providers()
|
||||
if info.supports_search
|
||||
)
|
||||
|
||||
|
||||
def get_upload_plugin(name: str,
|
||||
config: Optional[Dict[str, Any]] = None) -> Optional[FileProvider]:
|
||||
plugin = get_plugin(name, config)
|
||||
@@ -591,6 +600,15 @@ def list_upload_plugins(config: Optional[Dict[str, Any]] = None) -> Dict[str, bo
|
||||
return availability
|
||||
|
||||
|
||||
def list_upload_plugin_names() -> List[str]:
|
||||
"""Return registered upload-provider names without instantiating plugins."""
|
||||
return sorted(
|
||||
info.canonical_name
|
||||
for info in REGISTRY.iter_providers()
|
||||
if info.supports_upload
|
||||
)
|
||||
|
||||
|
||||
def match_plugin_name_for_url(url: str) -> Optional[str]:
|
||||
raw_url = str(url or "").strip()
|
||||
raw_url_lower = raw_url.lower()
|
||||
@@ -666,14 +684,20 @@ def plugin_inline_query_choices(
|
||||
if not pname or not field:
|
||||
return []
|
||||
|
||||
plugin = get_search_plugin(pname, config)
|
||||
if plugin is None:
|
||||
plugin = get_plugin(pname, config)
|
||||
if plugin is None:
|
||||
return []
|
||||
|
||||
try:
|
||||
mapping = _collect_inline_choice_mapping(plugin)
|
||||
mapping: Dict[str, List[Dict[str, Any]]] = {}
|
||||
info = REGISTRY.get(pname)
|
||||
if info is not None:
|
||||
mapping = _collect_inline_choice_mapping(info.provider_class)
|
||||
|
||||
if not mapping:
|
||||
plugin = get_search_plugin(pname, config)
|
||||
if plugin is None:
|
||||
plugin = get_plugin(pname, config)
|
||||
if plugin is None:
|
||||
return []
|
||||
mapping = _collect_inline_choice_mapping(plugin)
|
||||
|
||||
if not mapping:
|
||||
return []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user