Skip to content

Commit fc47c14

Browse files
author
Victoria Hall
committed
revert get_binding check, import by default
1 parent 14beca7 commit fc47c14

File tree

1 file changed

+8
-14
lines changed
  • azure_functions_worker/bindings

1 file changed

+8
-14
lines changed

azure_functions_worker/bindings/meta.py

+8-14
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,25 @@ def load_binding_registry() -> None:
3232

3333
# The SDKs only support python 3.8+
3434
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
3636
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:
4637
import azure.functions.extension.base as clients
4738
global SDK_BINDING_REGISTRY
4839
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
4944

5045

5146
def get_binding(bind_name: str, pytype: typing.Optional[type] = None) -> object:
5247
binding = get_deferred_binding(bind_name=bind_name, pytype=pytype)
5348

5449
# 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)
5552
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
6054

6155
return binding
6256

0 commit comments

Comments
 (0)