INNER CODE UNIT · Python
get_features
codeskyblue/uiautodev · uiautodev/app.py:75
def get_features(platform: str) -> Dict[str, bool]:
"""Get features supported by the specified platform"""
features = {}
# 获取所有带有指定平台tag的路由
from starlette.routing import Route
for route in app.routes:
_route: Route = route # type: ignore
if hasattr(_route, "tags") and platform in _route.tags:
if _route.path.startswith(f"/api/{platform}/{{serial}}/"):
# 提取特性名称
parts = _route.path.split("/")
feature_name = parts[-1]
if not feature_name.startswith("{"):
features[feature_name] = True
return features