@@ -74,7 +74,7 @@ def totally_new_function(value):
7474""" 
7575
7676    function_name : str  =  "NewClass.new_function" 
77-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
77+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
7878    new_code : str  =  replace_functions_and_add_imports (
7979        source_code = original_code ,
8080        function_names = [function_name ],
@@ -135,7 +135,7 @@ def other_function(st):
135135""" 
136136
137137    function_name : str  =  "NewClass.new_function" 
138-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
138+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
139139    new_code : str  =  replace_functions_and_add_imports (
140140        source_code = original_code ,
141141        function_names = [function_name ],
@@ -196,7 +196,7 @@ def totally_new_function(value):
196196""" 
197197
198198    function_names : list [str ] =  ["other_function" ]
199-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
199+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
200200    new_code : str  =  replace_functions_and_add_imports (
201201        source_code = original_code ,
202202        function_names = function_names ,
@@ -260,7 +260,7 @@ def totally_new_function(value):
260260""" 
261261
262262    function_names : list [str ] =  ["yet_another_function" , "other_function" ]
263-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
263+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
264264    new_code : str  =  replace_functions_and_add_imports (
265265        source_code = original_code ,
266266        function_names = function_names ,
@@ -313,7 +313,7 @@ def supersort(doink):
313313""" 
314314
315315    function_names : list [str ] =  ["sorter_deps" ]
316-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
316+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
317317    new_code : str  =  replace_functions_and_add_imports (
318318        source_code = original_code ,
319319        function_names = function_names ,
@@ -388,7 +388,7 @@ def blab(st):
388388
389389print("Not cool") 
390390""" 
391-     preexisting_objects  =  find_preexisting_objects (original_code_main ) +  find_preexisting_objects (original_code_helper )
391+     preexisting_objects  =  find_preexisting_objects (original_code_main ) |  find_preexisting_objects (original_code_helper )
392392    new_main_code : str  =  replace_functions_and_add_imports (
393393        source_code = original_code_main ,
394394        function_names = ["other_function" ],
@@ -591,7 +591,7 @@ def from_config(config: Optional[dict[str, Any]]):
591591            ) 
592592""" 
593593    function_names : list [str ] =  ["CacheSimilarityEvalConfig.from_config" ]
594-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
594+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
595595
596596    new_code : str  =  replace_functions_and_add_imports (
597597        source_code = original_code ,
@@ -662,7 +662,7 @@ def _hamming_distance(a: np.ndarray, b: np.ndarray) -> np.floating:
662662        return np.sum(a != b) / a.size 
663663''' 
664664    function_names : list [str ] =  ["_EmbeddingDistanceChainMixin._hamming_distance" ]
665-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
665+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
666666    new_code : str  =  replace_functions_and_add_imports (
667667        source_code = original_code ,
668668        function_names = function_names ,
@@ -715,7 +715,7 @@ def totally_new_function(value: Optional[str]):
715715print("Hello world") 
716716""" 
717717    function_name : str  =  "NewClass.__init__" 
718-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
718+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
719719    new_code : str  =  replace_functions_and_add_imports (
720720        source_code = original_code ,
721721        function_names = [function_name ],
@@ -814,8 +814,8 @@ def real_bar(self) -> int:
814814''' 
815815
816816    function_name : str  =  "Fu.foo" 
817-     parents  =  [ FunctionParent ("Fu" , "ClassDef" )] 
818-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  [ ("foo" , parents ), ("real_bar" , parents )] 
817+     parents  =  ( FunctionParent ("Fu" , "ClassDef" ),) 
818+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  { ("foo" , parents ), ("real_bar" , parents )} 
819819    new_code : str  =  replace_functions_in_file (
820820        source_code = original_code ,
821821        original_function_names = [function_name ],
@@ -854,7 +854,7 @@ def real_bar(self) -> int:
854854        pass 
855855''' 
856856
857-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  []
857+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  []
858858    new_code : str  =  replace_functions_in_file (
859859        source_code = original_code ,
860860        original_function_names = ["Fu.real_bar" ],
@@ -891,7 +891,7 @@ def __call__(self, value):
891891""" 
892892
893893    function_names : list [str ] =  ["yet_another_function" , "other_function" ]
894-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  []
894+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  []
895895    new_code : str  =  replace_functions_and_add_imports (
896896        source_code = original_code ,
897897        function_names = function_names ,
@@ -1278,7 +1278,7 @@ def cosine_similarity_top_k(
12781278
12791279    return ret_idxs, scores 
12801280''' 
1281-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
1281+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
12821282
12831283    helper_functions  =  [
12841284        FakeFunctionSource (
@@ -1579,7 +1579,7 @@ def nested_function(self):
15791579        "NewClass.new_function2" ,
15801580        "NestedClass.nested_function" ,
15811581    ]  # Nested classes should be ignored, even if provided as target 
1582-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
1582+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
15831583    new_code : str  =  replace_functions_and_add_imports (
15841584        source_code = original_code ,
15851585        function_names = function_names ,
@@ -1615,7 +1615,7 @@ def new_function2(value):
16151615""" 
16161616
16171617    function_names : list [str ] =  ["NewClass.__init__" , "NewClass.__call__" , "NewClass.new_function2" ]
1618-     preexisting_objects : list [tuple [str , list [FunctionParent ]]] =  find_preexisting_objects (original_code )
1618+     preexisting_objects : set [tuple [str , tuple [FunctionParent ,... ]]] =  find_preexisting_objects (original_code )
16191619    new_code : str  =  replace_functions_and_add_imports (
16201620        source_code = original_code ,
16211621        function_names = function_names ,
0 commit comments