Enforce modern Python typing annotations with Ruff (#8296)

Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
Graham Neubig
2025-05-06 07:58:33 -04:00
committed by GitHub
parent 4c1ae6fd8d
commit adfa510b5f
24 changed files with 79 additions and 72 deletions

View File

@@ -1,7 +1,7 @@
import asyncio
from concurrent import futures
from concurrent.futures import ThreadPoolExecutor
from typing import Callable, Coroutine, Iterable, List
from typing import Callable, Coroutine, Iterable
GENERAL_TIMEOUT: int = 15
EXECUTOR = ThreadPoolExecutor()
@@ -64,7 +64,7 @@ async def call_coro_in_bg_thread(
async def wait_all(
iterable: Iterable[Coroutine], timeout: int = GENERAL_TIMEOUT
) -> List:
) -> list:
"""
Shorthand for waiting for all the coroutines in the iterable given in parallel. Creates
a task for each coroutine.

View File

@@ -1,6 +1,6 @@
import importlib
from functools import lru_cache
from typing import Type, TypeVar
from typing import TypeVar
T = TypeVar('T')
@@ -15,7 +15,7 @@ def import_from(qual_name: str):
@lru_cache()
def get_impl(cls: Type[T], impl_name: str | None) -> Type[T]:
def get_impl(cls: type[T], impl_name: str | None) -> type[T]:
"""Import a named implementation of the specified class"""
if impl_name is None:
return cls