18
18
# Base extension supported Python minor version
19
19
BASE_EXT_SUPPORTED_PY_MINOR_VERSION = 8
20
20
21
- binding_registry = None
22
- deferred_binding_registry = None
21
+ BINDING_REGISTRY = None
22
+ DEFERRED_BINDING_REGISTRY = None
23
23
deferred_bindings_enabled = False
24
24
deferred_bindings_cache = {}
25
25
@@ -31,13 +31,13 @@ def load_binding_registry() -> None:
31
31
if func is None :
32
32
import azure .functions as func
33
33
34
- global binding_registry
35
- binding_registry = func .get_binding_registry ()
34
+ global BINDING_REGISTRY
35
+ BINDING_REGISTRY = func .get_binding_registry ()
36
36
37
- if binding_registry is None :
38
- # If the binding_registry is None, azure-functions hasn't been
37
+ if BINDING_REGISTRY is None :
38
+ # If the BINDING_REGISTRY is None, azure-functions hasn't been
39
39
# loaded in properly.
40
- raise AttributeError ('binding_registry is None. Sys Path:'
40
+ raise AttributeError ('BINDING_REGISTRY is None. Sys Path:'
41
41
f'{ sys .path } , Sys Module: { sys .modules } ,'
42
42
f'python-packages Path exists:'
43
43
f'{ os .path .exists (CUSTOMER_PACKAGES_PATH )} ' )
@@ -47,8 +47,8 @@ def load_binding_registry() -> None:
47
47
# Import the base extension
48
48
try :
49
49
import azure .functions .extension .base as clients
50
- global deferred_binding_registry
51
- deferred_binding_registry = clients .get_binding_registry ()
50
+ global DEFERRED_BINDING_REGISTRY
51
+ DEFERRED_BINDING_REGISTRY = clients .get_binding_registry ()
52
52
except ImportError :
53
53
# This means that the customer hasn't imported the library.
54
54
# This isn't an error.
@@ -58,9 +58,9 @@ def load_binding_registry() -> None:
58
58
def get_deferred_binding (bind_name : str ,
59
59
pytype : typing .Optional [type ] = None ) -> object :
60
60
# This will return None if not a supported type
61
- return deferred_binding_registry .get (bind_name )\
62
- if (deferred_binding_registry is not None
63
- and deferred_binding_registry .check_supported_type (
61
+ return DEFERRED_BINDING_REGISTRY .get (bind_name )\
62
+ if (DEFERRED_BINDING_REGISTRY is not None
63
+ and DEFERRED_BINDING_REGISTRY .check_supported_type (
64
64
pytype )) else None
65
65
66
66
@@ -69,7 +69,7 @@ def get_binding(bind_name: str, pytype: typing.Optional[type] = None) -> object:
69
69
binding = get_deferred_binding (bind_name = bind_name , pytype = pytype )
70
70
# Binding is not a deferred binding type
71
71
if binding is None :
72
- binding = binding_registry .get (bind_name )
72
+ binding = BINDING_REGISTRY .get (bind_name )
73
73
# Binding is generic
74
74
if binding is None :
75
75
binding = generic .GenericBinding
@@ -134,8 +134,8 @@ def from_incoming_proto(
134
134
135
135
try :
136
136
# if the binding is an sdk type binding
137
- if (deferred_binding_registry is not None
138
- and deferred_binding_registry .check_supported_type (pytype )):
137
+ if (DEFERRED_BINDING_REGISTRY is not None
138
+ and DEFERRED_BINDING_REGISTRY .check_supported_type (pytype )):
139
139
return deferred_bindings_decode (binding = binding ,
140
140
pb = pb ,
141
141
pytype = pytype ,
@@ -261,10 +261,10 @@ def deferred_bindings_decode(binding: typing.Any,
261
261
262
262
def set_deferred_bindings_flag (param_anno : type ):
263
263
# If flag hasn't already been set
264
- # If deferred_binding_registry is not None
264
+ # If DEFERRED_BINDING_REGISTRY is not None
265
265
# If the binding type is a deferred binding type
266
266
global deferred_bindings_enabled
267
267
if (not deferred_bindings_enabled
268
- and deferred_binding_registry is not None
269
- and deferred_binding_registry .check_supported_type (param_anno )):
268
+ and DEFERRED_BINDING_REGISTRY is not None
269
+ and DEFERRED_BINDING_REGISTRY .check_supported_type (param_anno )):
270
270
deferred_bindings_enabled = True
0 commit comments