Skip to content

Commit a591055

Browse files
committed
revert flag set
1 parent 109c078 commit a591055

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

azure_functions_worker/bindings/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .meta import has_implicit_output
99
from .meta import is_trigger_binding, load_binding_registry
1010
from .meta import from_incoming_proto, to_outgoing_proto, \
11-
to_outgoing_param_binding, set_deferred_bindings_flag
11+
to_outgoing_param_binding
1212
from .out import Out
1313

1414

@@ -19,5 +19,5 @@
1919
'check_input_type_annotation', 'check_output_type_annotation',
2020
'has_implicit_output',
2121
'from_incoming_proto', 'to_outgoing_proto', 'TraceContext', 'RetryContext',
22-
'to_outgoing_param_binding', 'set_deferred_bindings_flag'
22+
'to_outgoing_param_binding'
2323
)

azure_functions_worker/bindings/meta.py

+5-15
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,12 @@ def get_deferred_binding(bind_name: str,
216216
pytype: typing.Optional[type] = None) -> object:
217217
binding = None
218218

219-
if DEFERRED_BINDINGS_REGISTRY is None:
219+
if (DEFERRED_BINDINGS_REGISTRY is not None
220+
and DEFERRED_BINDINGS_REGISTRY.check_supported_type(pytype)):
221+
# Set flag once
220222
global DEFERRED_BINDINGS_ENABLED
221-
DEFERRED_BINDINGS_ENABLED = False
222-
# Checks if pytype is a supported sdk type
223-
elif DEFERRED_BINDINGS_REGISTRY.check_supported_type(pytype):
223+
if not DEFERRED_BINDINGS_ENABLED:
224+
DEFERRED_BINDINGS_ENABLED = True
224225
# Returns deferred binding converter
225226
binding = DEFERRED_BINDINGS_REGISTRY.get(bind_name)
226227

@@ -255,14 +256,3 @@ def deferred_bindings_decode(binding: typing.Any,
255256
DEFERRED_BINDINGS_CACHE[(pb.name, pytype, datum.value.content)]\
256257
= deferred_binding_type
257258
return deferred_binding_type
258-
259-
260-
def set_deferred_bindings_flag(param_anno: type):
261-
# If flag hasn't already been set
262-
# If DEFERRED_BINDINGS_REGISTRY is not None
263-
# If the binding type is a deferred binding type
264-
global DEFERRED_BINDINGS_ENABLED
265-
if (not DEFERRED_BINDINGS_ENABLED
266-
and DEFERRED_BINDINGS_REGISTRY is not None
267-
and DEFERRED_BINDINGS_REGISTRY.check_supported_type(param_anno)):
268-
DEFERRED_BINDINGS_ENABLED = True

azure_functions_worker/functions.py

-3
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,6 @@ def validate_function_params(params: dict, bound_params: dict,
144144
param_has_anno = param.name in annotations
145145
param_anno = annotations.get(param.name)
146146

147-
# Check the declared type
148-
bindings_utils.set_deferred_bindings_flag(param_anno)
149-
150147
if param_has_anno:
151148
if typing_inspect.is_generic_type(param_anno):
152149
param_anno_origin = typing_inspect.get_origin(param_anno)

0 commit comments

Comments
 (0)