Files
skill-template/tools/ui_inspector/adapters/registry.py
chendelian 633ecff4e2 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>
2026-08-07 11:19:14 +08:00

32 lines
615 B
Python

"""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)