@@ -52,23 +52,23 @@ def construct_ref(self, node):
5252 return Ref (ref )
5353
5454 def construct_call (self , name , node ):
55- if isinstance (node , yaml .ScalarNode ):
56- arg = self .construct_scalar (node )
57- args = [arg ] if arg != '' else []
58- kwargs = {}
59- elif isinstance (node , yaml .SequenceNode ):
60- args = self .construct_sequence (node )
61- kwargs = {}
62- elif isinstance (node , yaml .MappingNode ):
63- args = []
64- kwargs = self .construct_mapping (node )
65-
6655 try :
67- function = import_function (name )
56+ object = import_function (name )
6857 except (ModuleNotFoundError , AttributeError ) as e :
6958 raise ImportError (f'{ e } \n { node .start_mark } ' ) from e
7059
71- return Call (function , args , kwargs )
60+ if isinstance (node , yaml .ScalarNode ):
61+ if node .value :
62+ raise ValueError (f'{ node .value } : ScalarNode should be empty to import an object' )
63+ return object
64+ else :
65+ if isinstance (node , yaml .SequenceNode ):
66+ args = self .construct_sequence (node )
67+ kwargs = {}
68+ if isinstance (node , yaml .MappingNode ):
69+ args = []
70+ kwargs = self .construct_mapping (node )
71+ return Call (object , args , kwargs )
7272
7373 def construct_quantity (self , node ):
7474 value = self .construct_scalar (node )
0 commit comments