MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / __export_blob

Method __export_blob

aura/analyzers/data_finder.py:73–95  ·  view source on GitHub ↗
(self, blob: Union[bytes, str], context: Context)

Source from the content-addressed store, hash-verified

71 yield self.__export_blob(context.node.value, context)
72
73 def __export_blob(self, blob: Union[bytes, str], context: Context) -> ScanLocation:
74 tmp_dir = tempfile.mkdtemp(prefix="aura_pkg__sandbox_blob_")
75 file_pth = os.path.join(tmp_dir, "blob")
76
77 location = context.visitor.location.create_child(
78 parent=context.visitor.location,
79 new_location=tmp_dir,
80 cleanup=True,
81 strip_path=tmp_dir
82 )
83 location.metadata["source"] = "blob"
84 location.metadata["parent_line"] = context.node.line_no
85
86 if type(blob) == str:
87 mode = "w"
88 else:
89 mode = "wb"
90
91 with open(file_pth, mode) as fd:
92 fd.write(blob)
93 fd.flush()
94
95 return location
96
97
98@Analyzer.ID("string_finder")

Callers 2

node_StringMethod · 0.95
node_BinaryMethod · 0.95

Calls 2

joinMethod · 0.80
create_childMethod · 0.80

Tested by

no test coverage detected