diff --git a/providers/src/airflow/providers/edge/worker_api/datamodels.py b/providers/src/airflow/providers/edge/worker_api/datamodels.py index 67cafddad3dab..fcfc47fc5bdfd 100644 --- a/providers/src/airflow/providers/edge/worker_api/datamodels.py +++ b/providers/src/airflow/providers/edge/worker_api/datamodels.py @@ -17,13 +17,9 @@ from __future__ import annotations from datetime import datetime -from typing import ( # noqa: UP035 - prevent pytest failing in back-compat +from typing import ( Annotated, Any, - Dict, - List, - Optional, - Union, ) from pydantic import BaseModel, Field @@ -61,7 +57,7 @@ class JsonRpcRequest(JsonRpcRequestBase): jsonrpc: Annotated[str, Field(description="JSON RPC Version", examples=["2.0"])] params: Annotated[ - Optional[Dict[str, Any]], # noqa: UP006, UP007 - prevent pytest failing in back-compat + dict[str, Any] | None, Field(description="Dictionary of parameters passed to the method."), ] @@ -103,7 +99,7 @@ class WorkerQueuesBase(BaseModel): """Queues that a worker supports to run jobs on.""" queues: Annotated[ - Optional[List[str]], # noqa: UP006, UP007 - prevent pytest failing in back-compat + list[str] | None, Field( None, description="List of queues the worker is pulling jobs from. If not provided, worker pulls from all queues.", @@ -123,13 +119,13 @@ class WorkerStateBody(WorkerQueuesBase): state: Annotated[EdgeWorkerState, Field(description="State of the worker from the view of the worker.")] jobs_active: Annotated[int, Field(description="Number of active jobs the worker is running.")] = 0 queues: Annotated[ - Optional[List[str]], # noqa: UP006, UP007 - prevent pytest failing in back-compat + list[str] | None, Field( description="List of queues the worker is pulling jobs from. If not provided, worker pulls from all queues." ), ] = None sysinfo: Annotated[ - Dict[str, Union[str, int]], # noqa: UP006, UP007 - prevent pytest failing in back-compat + dict[str, str | int], Field( description="System information of the worker.", examples=[ @@ -148,11 +144,11 @@ class WorkerQueueUpdateBody(BaseModel): """Changed queues for the worker.""" new_queues: Annotated[ - Optional[List[str]], # noqa: UP006, UP007 - prevent pytest failing in back-compat + list[str] | None, Field(description="Additional queues to be added to worker."), ] remove_queues: Annotated[ - Optional[List[str]], # noqa: UP006, UP007 - prevent pytest failing in back-compat + list[str] | None, Field(description="Queues to remove from worker."), ]