chore: archive tools/ui_inspector snapshot before migration removal.
Keep the last in-template copy on main so history can restore it; product continues in jiangchang-ui-recorder. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
31
tools/ui_inspector/adapters/registry.py
Normal file
31
tools/ui_inspector/adapters/registry.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Adapter registry."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Optional
|
||||
|
||||
_REGISTRY: list[Any] = []
|
||||
|
||||
|
||||
def register_adapter(adapter: Any) -> Any:
|
||||
_REGISTRY.append(adapter)
|
||||
return adapter
|
||||
|
||||
|
||||
def get_adapter(
|
||||
*,
|
||||
class_name: str = "",
|
||||
title: str = "",
|
||||
process_name: str = "",
|
||||
) -> Optional[Any]:
|
||||
for ad in _REGISTRY:
|
||||
try:
|
||||
if ad.matches(class_name=class_name, title=title, process_name=process_name):
|
||||
return ad
|
||||
except Exception:
|
||||
continue
|
||||
return None
|
||||
|
||||
|
||||
def all_adapters() -> list[Any]:
|
||||
return list(_REGISTRY)
|
||||
Reference in New Issue
Block a user