Edward J. Schwartz commited on
Commit
48b6277
1 Parent(s): 08c3539
Files changed (1) hide show
  1. oo-method-test-split.py +9 -3
oo-method-test-split.py CHANGED
@@ -126,26 +126,32 @@ class OOMethodTestDataset(datasets.ArrowBasedBuilder):
126
  elif self.config.name in ["bylibrary", "bylibrarydedup"]:
127
  # A function (name) is a library function if it appears in more than one Exename
128
 
129
- # this is (('func', 'oo.exe'): 123)
130
  testcount = set(zip(ds['Name'], ds['Exename']))
131
 
 
 
 
132
  # sorted pairs by function name
133
  testcount = sorted(testcount, key=lambda x: x[0])
 
134
 
135
  # group by function name
136
  grouped = itertools.groupby(testcount, lambda t: t[0])
 
137
 
138
  grouped = {k: [b for _,b in g] for k, g in grouped}
 
139
 
140
  library_func_names = {f for f, exes in grouped.items() if len(exes) > 1}
141
- library_func_names_dedup = {(f, exes[0]) for f, exes in grouped.items() if len(exes) > 1}
142
  nonlibrary_func_names = {f for f, exes in grouped.items() if len(exes) == 1}
143
 
144
  train_filter_fun = None
145
  if self.config.name == "bylibrary":
146
  train_filter_fun = lambda r: r['Name'] in library_func_names
147
  elif self.config.name == "bylibrarydedup":
148
- train_filter_fun = lambda r: (r['Name'], r['Exename']) in library_func_names_dedup
149
  else:
150
  assert False, "Invalid configuration"
151
 
 
126
  elif self.config.name in ["bylibrary", "bylibrarydedup"]:
127
  # A function (name) is a library function if it appears in more than one Exename
128
 
129
+ # this is (('func', 'oo.exe'))
130
  testcount = set(zip(ds['Name'], ds['Exename']))
131
 
132
+ # (('func', 'path/oo.exe'))
133
+ testcountfull = set(zip(ds['Name'], ds['Binary']))
134
+
135
  # sorted pairs by function name
136
  testcount = sorted(testcount, key=lambda x: x[0])
137
+ testcountfull = sorted(testcountfull, key=lambda x: x[0])
138
 
139
  # group by function name
140
  grouped = itertools.groupby(testcount, lambda t: t[0])
141
+ groupedfull = itertools.groupby(testcountfull, lambda t: t[0])
142
 
143
  grouped = {k: [b for _,b in g] for k, g in grouped}
144
+ groupedfull = {k: [b for _,b in g] for k, g in groupedfull}
145
 
146
  library_func_names = {f for f, exes in grouped.items() if len(exes) > 1}
147
+ library_func_names_dedup = {(f, exes[0]) for f, exes in groupedfull.items() if len(exes) > 1}
148
  nonlibrary_func_names = {f for f, exes in grouped.items() if len(exes) == 1}
149
 
150
  train_filter_fun = None
151
  if self.config.name == "bylibrary":
152
  train_filter_fun = lambda r: r['Name'] in library_func_names
153
  elif self.config.name == "bylibrarydedup":
154
+ train_filter_fun = lambda r: (r['Name'], r['Binary']) in library_func_names_dedup
155
  else:
156
  assert False, "Invalid configuration"
157