MCPcopy Index your code
hub / github.com/SourceCode-AI/aura / as_dict

Method as_dict

aura/diff.py:92–121  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

90 self.removed_detections = [x for x in a_detections if x.diff_hash not in duplicates]
91
92 def as_dict(self) -> dict:
93 d = {
94 "operation": self.operation,
95 "diff": self.diff,
96 "similarity": self.similarity
97 }
98
99 if self.a_scan is not None:
100 d.update({
101 "a_ref": str(self.a_scan),
102 "a_md5": self.a_scan.metadata.get("md5"),
103 "a_mime": self.a_scan.metadata.get("mime"),
104 "a_size": self.a_scan.size,
105 })
106
107 if self.b_scan is not None:
108 d.update({
109 "b_ref": str(self.b_scan),
110 "b_md5": self.b_scan.metadata.get("md5"),
111 "b_mime": self.b_scan.metadata.get("mime"),
112 "b_size": self.b_scan.size,
113 })
114
115 if self.new_detections:
116 d["new_detections"] = [x._asdict() for x in self.new_detections]
117
118 if self.removed_detections:
119 d["removed_detections"] = [x._asdict() for x in self.removed_detections]
120
121 return d
122
123 def pprint(self):
124 from prettyprinter import pprint as pp

Callers 3

test_diff_archivesFunction · 0.80
output_diffMethod · 0.80
output_diffMethod · 0.80

Calls 2

getMethod · 0.80
_asdictMethod · 0.80

Tested by 1

test_diff_archivesFunction · 0.64