Skip to content

Commit 3fb3b0b

Browse files
committed
starting datatypes
1 parent 83f48bb commit 3fb3b0b

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

revengai/features/match_functions/match_functions.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ def _process_batch(self, function_ids: List[int], id_to_addr: Dict[int, int], co
101101
line["icon_text"] = "Success"
102102
matched_count += 1
103103
break
104-
105-
lines.append(line)
104+
105+
if line not in lines:
106+
lines.append(line)
106107

107108
except Exception as e:
108109
log_error(f"RevEng.AI | Error processing function {result['origin_function_id']}: {str(e)}")
@@ -206,8 +207,13 @@ def parse_confidence(item):
206207
return float(item["confidence"].strip('%'))
207208
except (KeyError, ValueError):
208209
return 0.0
209-
210+
211+
#sorted_list = sorted(result["data"], key=lambda x: int(x["function_address"]) if x["function_address"] != "N/A" else 0)
210212
sorted_list = sorted(result["data"], key=parse_confidence, reverse=True)
213+
214+
#seen = {}
215+
#sorted_list = [seen.setdefault(str(x), x) for x in sorted_list if str(x) not in seen]
216+
211217
result["data"] = sorted_list
212218

213219
return True, result
@@ -374,9 +380,9 @@ def _process_data_type_batch(self, chunk: List[Dict]) -> List[Dict]:
374380
total_data_types = data.get("total_data_types_count", 0)
375381
items = data.get("items", [])
376382
log_info(f"RevEng.AI | Response: {response}")
377-
if total_count != total_data_types or all(item.get("completed", False) for item in items):
383+
if not any(item.get("status") == "pending" for item in items):
378384
break
379-
time.sleep(1)
385+
time.sleep(3)
380386

381387
for item in items:
382388
log_info(f"RevEng.AI | Item: {item['function_id']}")
@@ -400,10 +406,10 @@ def make_signature(self, data_types: List[Dict]) -> str:
400406
try:
401407
log_info(f"RevEng.AI | Making signature for {data_types}")
402408
signature = ""
403-
signature += f"{data_types['func_types'].get('name', 'N/A')} "
409+
signature += f"{data_types['func_types'].get('type', 'N/A')} "
404410

405-
for dep in data_types['func_deps']:
406-
signature += f"{dep.get('name', 'N/A')} "
411+
for arg in data_types['func_types'].get('args', []):
412+
signature += f"{arg.get('type', 'N/A')}, "
407413

408414
log_info(f"RevEng.AI | Signature: {signature}")
409415
return signature

0 commit comments

Comments
 (0)