ruff auto fixes
This commit is contained in:
parent
5040f8dee7
commit
56918f7472
4 changed files with 12 additions and 12 deletions
|
|
@ -224,7 +224,7 @@ class BuildEventSource:
|
|||
return
|
||||
self.queue.put_nowait(self._serialize(event, build))
|
||||
|
||||
async def events(self) -> AsyncGenerator[str, None]:
|
||||
async def events(self) -> AsyncGenerator[str]:
|
||||
for build in controller.db.search(
|
||||
repo=self.repo,
|
||||
target_branch=self.target_branch,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from . import __version__, api, controller, k8s, webhooks, webui
|
|||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
|
||||
async def lifespan(app: FastAPI) -> AsyncGenerator[None]:
|
||||
await k8s.load_kube_config()
|
||||
await controller.controller.start()
|
||||
yield
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class WatchException(Exception):
|
|||
|
||||
def _watch(
|
||||
list_method: Callable[..., Any], *args: Any, **kwargs: Any
|
||||
) -> Generator[tuple[str | None, Any], None, None]:
|
||||
) -> Generator[tuple[str | None, Any]]:
|
||||
while True:
|
||||
try:
|
||||
# perform a first query
|
||||
|
|
@ -121,7 +121,7 @@ def _watch(
|
|||
|
||||
|
||||
@sync_to_async_iterator
|
||||
def watch_deployments() -> Generator[V1Deployment, None, None]:
|
||||
def watch_deployments() -> Generator[V1Deployment]:
|
||||
appsv1 = client.AppsV1Api()
|
||||
yield from _watch(
|
||||
appsv1.list_namespaced_deployment, namespace=settings.build_namespace
|
||||
|
|
@ -129,7 +129,7 @@ def watch_deployments() -> Generator[V1Deployment, None, None]:
|
|||
|
||||
|
||||
@sync_to_async_iterator
|
||||
def watch_jobs() -> Generator[V1Job, None, None]:
|
||||
def watch_jobs() -> Generator[V1Job]:
|
||||
batchv1 = client.BatchV1Api()
|
||||
yield from _watch(batchv1.list_namespaced_job, namespace=settings.build_namespace)
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ def make_deployment_vars(
|
|||
|
||||
|
||||
@contextmanager
|
||||
def _get_kubefiles_path(kubefiles_path: Path | None) -> Generator[Path, None, None]:
|
||||
def _get_kubefiles_path(kubefiles_path: Path | None) -> Generator[Path]:
|
||||
if kubefiles_path:
|
||||
yield kubefiles_path
|
||||
else:
|
||||
|
|
@ -191,7 +191,7 @@ def _get_kubefiles_path(kubefiles_path: Path | None) -> Generator[Path, None, No
|
|||
@contextmanager
|
||||
def _render_kubefiles(
|
||||
kubefiles_path: Path | None, deployment_vars: DeploymentVars
|
||||
) -> Generator[Path, None, None]:
|
||||
) -> Generator[Path]:
|
||||
with (
|
||||
_get_kubefiles_path(kubefiles_path) as kubefiles_path,
|
||||
tempfile.TemporaryDirectory() as tmp_dir,
|
||||
|
|
@ -299,7 +299,7 @@ def log(build_name: str, job_kind: DeploymentMode | None) -> str | None:
|
|||
container=pod.metadata.annotations.get(
|
||||
"kubectl.kubernetes.io/default-container"
|
||||
),
|
||||
tail_lines=None if job_kind else None,
|
||||
tail_lines=None,
|
||||
follow=False,
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ def sync_to_async(func: Callable[P, R]) -> Callable[P, Awaitable[R]]:
|
|||
|
||||
|
||||
def sync_to_async_iterator(
|
||||
iterator_func: Callable[P, Generator[R, None, None]],
|
||||
) -> Callable[P, AsyncGenerator[R, None]]:
|
||||
iterator_func: Callable[P, Generator[R]],
|
||||
) -> Callable[P, AsyncGenerator[R]]:
|
||||
@sync_to_async
|
||||
def async_next(iterator: Iterator[R]) -> R:
|
||||
try:
|
||||
|
|
@ -38,11 +38,11 @@ def sync_to_async_iterator(
|
|||
raise StopAsyncIteration() from e
|
||||
|
||||
@sync_to_async
|
||||
def async_iterator_func(*args: Any, **kwargs: Any) -> Generator[R, None, None]:
|
||||
def async_iterator_func(*args: Any, **kwargs: Any) -> Generator[R]:
|
||||
return iterator_func(*args, **kwargs)
|
||||
|
||||
@wraps(iterator_func)
|
||||
async def inner(*args: Any, **kwargs: Any) -> AsyncGenerator[R, None]:
|
||||
async def inner(*args: Any, **kwargs: Any) -> AsyncGenerator[R]:
|
||||
iterator = await async_iterator_func(*args, **kwargs)
|
||||
while True:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue