@@ -31,6 +31,8 @@ class FunctionInfo(typing.NamedTuple):
31
31
output_types : typing .Mapping [str , ParamTypeInfo ]
32
32
return_type : typing .Optional [ParamTypeInfo ]
33
33
34
+ deferred_bindings_enabled : bool
35
+
34
36
35
37
class FunctionLoadError (RuntimeError ):
36
38
@@ -137,15 +139,19 @@ def validate_function_params(params: dict, bound_params: dict,
137
139
138
140
input_types : typing .Dict [str , ParamTypeInfo ] = {}
139
141
output_types : typing .Dict [str , ParamTypeInfo ] = {}
142
+ deferred_bindings_enabled = False
140
143
141
144
for param in params .values ():
142
145
binding = bound_params [param .name ]
143
146
144
147
param_has_anno = param .name in annotations
145
148
param_anno = annotations .get (param .name )
146
149
147
- # Check the declared type
148
- bindings_utils .set_deferred_bindings_flag (param_anno )
150
+ # Check if deferred bindings is enabled
151
+ deferred_bindings_enabled = (
152
+ bindings_utils .check_deferred_bindings_enabled (
153
+ param_anno ,
154
+ deferred_bindings_enabled ))
149
155
150
156
if param_has_anno :
151
157
if typing_inspect .is_generic_type (param_anno ):
@@ -245,7 +251,7 @@ def validate_function_params(params: dict, bound_params: dict,
245
251
output_types [param .name ] = param_type_info
246
252
else :
247
253
input_types [param .name ] = param_type_info
248
- return input_types , output_types
254
+ return input_types , output_types , deferred_bindings_enabled
249
255
250
256
@staticmethod
251
257
def get_function_return_type (annotations : dict , has_explicit_return : bool ,
@@ -298,7 +304,8 @@ def add_func_to_registry_and_return_funcinfo(self, function,
298
304
str , ParamTypeInfo ],
299
305
output_types : typing .Dict [
300
306
str , ParamTypeInfo ],
301
- return_type : str ):
307
+ return_type : str ,
308
+ deferred_bindings_enabled : bool ):
302
309
303
310
function_info = FunctionInfo (
304
311
func = function ,
@@ -310,7 +317,8 @@ def add_func_to_registry_and_return_funcinfo(self, function,
310
317
has_return = has_explicit_return or has_implicit_return ,
311
318
input_types = input_types ,
312
319
output_types = output_types ,
313
- return_type = return_type )
320
+ return_type = return_type ,
321
+ deferred_bindings_enabled = deferred_bindings_enabled )
314
322
315
323
self ._functions [function_id ] = function_info
316
324
return function_info
@@ -347,10 +355,10 @@ def add_function(self, function_id: str,
347
355
annotations ,
348
356
func_name )
349
357
350
- input_types , output_types = self .validate_function_params (params ,
351
- bound_params ,
352
- annotations ,
353
- func_name )
358
+ input_types , output_types , _ = self .validate_function_params (params ,
359
+ bound_params ,
360
+ annotations ,
361
+ func_name )
354
362
355
363
return_type = \
356
364
self .get_function_return_type (annotations ,
@@ -366,7 +374,7 @@ def add_function(self, function_id: str,
366
374
has_explicit_return ,
367
375
has_implicit_return ,
368
376
input_types ,
369
- output_types , return_type )
377
+ output_types , return_type , _ )
370
378
371
379
def add_indexed_function (self , function ):
372
380
func = function .get_user_function ()
@@ -404,10 +412,12 @@ def add_indexed_function(self, function):
404
412
annotations ,
405
413
func_name )
406
414
407
- input_types , output_types = self .validate_function_params (params ,
408
- bound_params ,
409
- annotations ,
410
- func_name )
415
+ (input_types , output_types ,
416
+ deferred_bindings_enabled ) = self .validate_function_params (
417
+ params ,
418
+ bound_params ,
419
+ annotations ,
420
+ func_name )
411
421
412
422
return_type = \
413
423
self .get_function_return_type (annotations ,
@@ -425,4 +435,5 @@ def add_indexed_function(self, function):
425
435
has_implicit_return ,
426
436
input_types ,
427
437
output_types ,
428
- return_type )
438
+ return_type ,
439
+ deferred_bindings_enabled )
0 commit comments