@@ -32,31 +32,25 @@ def load_binding_registry() -> None:
32
32
33
33
# The SDKs only support python 3.8+
34
34
if sys .version_info .minor >= BASE_EXT_SUPPORTED_PY_MINOR_VERSION :
35
- # Check if cx has imported sdk bindings library
35
+ # Import the base extension
36
36
try :
37
- clients = importlib .util .find_spec ('azure.functions.extension.base' )
38
- except ModuleNotFoundError :
39
- # This will throw a ModuleNotFoundError in env reload because
40
- # azure.functions.extension isn't loaded in
41
- clients = None
42
-
43
- # This will be None if the library is not imported
44
- # If it is not None, we want to set and use the registry
45
- if clients is not None :
46
37
import azure .functions .extension .base as clients
47
38
global SDK_BINDING_REGISTRY
48
39
SDK_BINDING_REGISTRY = clients .get_binding_registry ()
40
+ except ImportError :
41
+ # This will throw a ModuleNotFoundError in env reload because
42
+ # azure.functions.extension isn't loaded in
43
+ pass
49
44
50
45
51
46
def get_binding (bind_name : str , pytype : typing .Optional [type ] = None ) -> object :
52
47
binding = get_deferred_binding (bind_name = bind_name , pytype = pytype )
53
48
54
49
# Either cx didn't import library or didn't define sdk type
50
+ if binding is None and BINDING_REGISTRY is not None :
51
+ binding = BINDING_REGISTRY .get (bind_name )
55
52
if binding is None :
56
- if BINDING_REGISTRY is not None :
57
- binding = BINDING_REGISTRY .get (bind_name )
58
- else :
59
- binding = generic .GenericBinding
53
+ binding = generic .GenericBinding
60
54
61
55
return binding
62
56
0 commit comments