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 a42b3ad commit d491db0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions executor/engine/job/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,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
if "_thread_locals" not in globals():
Expand All @@ -49,15 +50,15 @@ def _gen_initializer(gen_func, args=tuple(), kwargs={}): # pragma: no cover
_thread_locals._generator = gen_func(*args, **kwargs)


def _gen_next(fut = 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 = 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 All @@ -69,6 +70,7 @@ class GeneratorWrapper(T.Generic[_T]):
"""
wrap a generator in executor pool
"""

def __init__(self, job: "Job", fut: T.Optional[Future] = None):
self._job = job
self._fut = fut
Expand Down

0 comments on commit d491db0

Please sign in to comment.