Skip to content

Commit 7971498

Browse files
author
Victoria Hall
committed
changing bind_name (fails until exts)
1 parent 40ef29b commit 7971498

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

azure_functions_worker/bindings/meta.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,18 @@ def load_binding_registry() -> None:
5454
pass
5555

5656

57-
def get_deferred_binding(bind_name: str,
58-
pytype: typing.Optional[type] = None) -> object:
57+
def get_deferred_binding(bind_name: str) -> object:
5958
# This will return None if not a supported type
6059
return DEFERRED_BINDING_REGISTRY.get(bind_name)\
61-
if (DEFERRED_BINDING_REGISTRY is not None
62-
and DEFERRED_BINDING_REGISTRY.check_supported_type(
63-
pytype)) else None
60+
if (bind_name[-3:] == '-db') else None
6461

6562

66-
def get_binding(bind_name: str, pytype: typing.Optional[type] = None) -> object:
67-
# Check if binding is deferred binding
68-
binding = get_deferred_binding(bind_name=bind_name, pytype=pytype)
69-
# Binding is not a deferred binding type
63+
def get_binding(bind_name: str) -> object:
64+
binding = None
7065
if binding is None:
7166
binding = BINDING_REGISTRY.get(bind_name)
67+
if binding is None:
68+
binding = get_deferred_binding(bind_name=bind_name)
7269
# Binding is generic
7370
if binding is None:
7471
binding = generic.GenericBinding
@@ -81,8 +78,7 @@ def is_trigger_binding(bind_name: str) -> bool:
8178

8279

8380
def check_input_type_annotation(bind_name: str, pytype: type) -> bool:
84-
# check that needs to pass for sdk bindings -- pass in pytype
85-
binding = get_binding(bind_name, pytype)
81+
binding = get_binding(bind_name)
8682
return binding.check_input_type_annotation(pytype)
8783

8884

@@ -106,12 +102,12 @@ def has_implicit_output(bind_name: str) -> bool:
106102

107103

108104
def from_incoming_proto(
109-
binding: str,
105+
bind_name: str,
110106
pb: protos.ParameterBinding, *,
111107
pytype: typing.Optional[type],
112108
trigger_metadata: typing.Optional[typing.Dict[str, protos.TypedData]],
113109
shmem_mgr: SharedMemoryManager) -> typing.Any:
114-
binding = get_binding(binding, pytype)
110+
binding = get_binding(bind_name)
115111
if trigger_metadata:
116112
metadata = {
117113
k: datumdef.Datum.from_typed_data(v)
@@ -133,8 +129,7 @@ def from_incoming_proto(
133129

134130
try:
135131
# if the binding is an sdk type binding
136-
if (DEFERRED_BINDING_REGISTRY is not None
137-
and DEFERRED_BINDING_REGISTRY.check_supported_type(pytype)):
132+
if bind_name[-3:] == '-db':
138133
return deferred_bindings_decode(binding=binding,
139134
pb=pb,
140135
pytype=pytype,

azure_functions_worker/functions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ def validate_function_params(params: dict, bound_params: dict,
221221
param_bind_type = 'generic'
222222
else:
223223
param_bind_type = binding.type
224+
if (deferred_bindings_enabled
225+
and bindings_utils.meta.DEFERRED_BINDING_REGISTRY.check_supported_type(
226+
param_py_type)):
227+
param_bind_type += "-db"
224228

225229
if param_has_anno:
226230
if is_param_out:

0 commit comments

Comments
 (0)