@@ -43,20 +43,15 @@ def load_binding_registry() -> None:
43
43
44
44
45
45
def get_binding (bind_name : str , pytype : typing .Optional [type ] = None ) -> object :
46
- try :
47
- # Check if binding is deferred binding
48
- binding = get_deferred_binding (bind_name = bind_name , pytype = pytype )
49
- # Binding is not deferred binding type
50
- if binding is None :
51
- binding = BINDING_REGISTRY .get (bind_name )
52
- # Binding is generic
53
- if binding is None :
54
- binding = generic .GenericBinding
55
- return binding
56
- except AttributeError :
57
- # If BINDING_REGISTRY is None, azure-functions hasn't been loaded
58
- # in correctly.
59
- raise AttributeError ("BINDING_REGISTRY is None." )
46
+ # Check if binding is deferred binding
47
+ binding = get_deferred_binding (bind_name = bind_name , pytype = pytype )
48
+ # Binding is not deferred binding type
49
+ if binding is None :
50
+ binding = BINDING_REGISTRY .get (bind_name )
51
+ # Binding is generic
52
+ if binding is None :
53
+ binding = generic .GenericBinding
54
+ return binding
60
55
61
56
62
57
def is_trigger_binding (bind_name : str ) -> bool :
@@ -219,22 +214,16 @@ def to_outgoing_param_binding(binding: str, obj: typing.Any, *,
219
214
220
215
def get_deferred_binding (bind_name : str ,
221
216
pytype : typing .Optional [type ] = None ) -> object :
222
- try :
223
- binding = None
224
-
225
- # Checks if pytype is a supported sdk type
226
- if DEFERRED_BINDINGS_REGISTRY .check_supported_type (pytype ):
227
- # Returns deferred binding converter
228
- binding = DEFERRED_BINDINGS_REGISTRY .get (bind_name )
229
-
230
- # This will return None if not a supported type
231
- return binding
232
- except AttributeError :
233
- # This will catch if DEFERRED_BINDINGS_REGISTRY is None
234
- # It will be None if the library isn't imported
235
- # Ensure that the flag is set to False in this case
236
- global DEFERRED_BINDINGS_ENABLED
237
- DEFERRED_BINDINGS_ENABLED = False
217
+ binding = None
218
+
219
+ # Checks if pytype is a supported sdk type
220
+ if (DEFERRED_BINDINGS_REGISTRY is not None
221
+ and DEFERRED_BINDINGS_REGISTRY .check_supported_type (pytype )):
222
+ # Returns deferred binding converter
223
+ binding = DEFERRED_BINDINGS_REGISTRY .get (bind_name )
224
+
225
+ # This will return None if not a supported type
226
+ return binding
238
227
239
228
240
229
def deferred_bindings_decode (binding : typing .Any ,
0 commit comments