Skip to content

Commit 8b8c589

Browse files
committed
lint + comments
1 parent 1c50212 commit 8b8c589

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

azure_functions_worker/dispatcher.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ async def dispatch_forever(self): # sourcery skip: swap-if-expression
155155
worker_id=self.worker_id)))
156156

157157
# In Python 3.11+, constructing a task has an optional context
158-
# parameter
158+
# parameter. Allow for this param to be passed to ContextEnabledTask
159159
# https://github.com/Azure/azure-functions-python-worker/issues/1508
160160
self._loop.set_task_factory(
161-
lambda loop, coro, context=None: ContextEnabledTask(
162-
coro, loop=loop, context=context))
161+
lambda loop, coro, context=None: ContextEnabledTask(
162+
coro, loop=loop, context=context))
163163

164164
# Detach console logging before enabling GRPC channel logging
165165
logger.info('Detaching console logging.')
@@ -1017,6 +1017,8 @@ class ContextEnabledTask(asyncio.Task):
10171017
AZURE_INVOCATION_ID = '__azure_function_invocation_id__'
10181018

10191019
def __init__(self, coro, loop, context=None):
1020+
# The context param is only available for 3.11+. If
1021+
# not, it can't be sent in the init() call.
10201022
if sys.version_info.minor >= 11:
10211023
super().__init__(coro, loop=loop, context=context)
10221024
else:

0 commit comments

Comments
 (0)