Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
liunux4odoo committed Sep 27, 2024
1 parent 88348f0 commit a42b3ad
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions executor/engine/job/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
if T.TYPE_CHECKING:
from .base import Job


JobStatusType = T.Literal['pending', 'running', 'failed', 'done', 'cancelled']
valid_job_statuses: T.List[JobStatusType] = [
'pending', 'running', 'failed', 'done', 'cancelled']
Expand Down Expand Up @@ -40,7 +39,7 @@ def __init__(self, job: "Job", valid_status: T.List[JobStatusType]):


_T = T.TypeVar("_T")

_thread_locals = threading.local()

def _gen_initializer(gen_func, args=tuple(), kwargs={}): # pragma: no cover
global _thread_locals
Expand All @@ -50,15 +49,15 @@ def _gen_initializer(gen_func, args=tuple(), kwargs={}): # pragma: no cover
_thread_locals._generator = gen_func(*args, **kwargs)


def _gen_next(fut: T.Optional[Future] = None): # pragma: no cover
def _gen_next(fut = None): # pragma: no cover
global _thread_locals
if fut is None:
return next(_thread_locals._generator)
else:
return next(fut)


def _gen_anext(fut: T.Optional[Future] = None): # pragma: no cover
def _gen_anext(fut = None): # pragma: no cover
global _thread_locals
if fut is None:
return asyncio.run(_thread_locals._generator.__anext__())
Expand Down

0 comments on commit a42b3ad

Please sign in to comment.