polish code with new pre-commit rule (#2923)

This commit is contained in:
Zero Rains
2025-07-19 23:19:27 +08:00
committed by GitHub
parent b8676d71a8
commit 25698d56d1
424 changed files with 14307 additions and 13518 deletions

View File

@@ -22,22 +22,20 @@ from fastdeploy.utils import resolve_obj_from_strname
def backend_name_to_enum(backend_name: str) -> _Backend:
"""backend_name_to_enum """
"""backend_name_to_enum"""
assert backend_name is not None
return _Backend.__members__.get(backend_name)
@cache
def _get_attn_backend(selected_backend: str) -> object:
"""_get_attn_backend """
"""_get_attn_backend"""
if isinstance(selected_backend, str):
selected_backend = backend_name_to_enum(selected_backend)
attention_cls = current_platform.get_attention_backend_cls(
selected_backend)
attention_cls = current_platform.get_attention_backend_cls(selected_backend)
if not attention_cls:
raise ValueError(
f"Invalid attention backend for {current_platform.device_name}")
raise ValueError(f"Invalid attention backend for {current_platform.device_name}")
return resolve_obj_from_strname(attention_cls)