File size: 742 Bytes
f0f4f2b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import os
import sys
import shutil

source_path = "function_pair_with_identical_functionality"
target_project = sys.argv[1]

projects = os.listdir(source_path)
for project in projects:
    if project == target_project :
        pairs = os.listdir(os.path.join(source_path, project))
        for pair in pairs:
            function_files = os.listdir(os.path.join(source_path, project, pair))
            for function_file in function_files:
                with open(os.path.join(source_path, project, pair, function_file), 'r') as input_file:
                    context = input_file.read()
                if context.startswith("None"):
                    os.remove(os.path.join(source_path, project, pair, function_file))