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

Method create_child

aura/uri_handlers/base.py:259–297  ·  view source on GitHub ↗
(self, new_location: Union[str, Path], metadata=None, **kwargs)

Source from the content-addressed store, hash-verified

257 return self.metadata.get("md5")
258
259 def create_child(self, new_location: Union[str, Path], metadata=None, **kwargs) -> ScanLocation:
260 if metadata is None:
261 metadata = copy.deepcopy(self.metadata)
262 metadata["depth"] = self.metadata["depth"] + 1
263
264 for x in ("mime", "interpreter_path", "interpreter_name"):
265 metadata.pop(x, None)
266
267 metadata["analyzers"] = self.metadata.get("analyzers")
268
269 if type(new_location) == str:
270 str_loc = new_location
271 new_location = Path(new_location)
272 else:
273 str_loc = os.fspath(new_location)
274
275 if "parent" in kwargs:
276 parent = kwargs["parent"]
277 elif self.location.is_dir():
278 parent = self.parent
279 else:
280 parent = self.location # FIXME refactor, parent should be only None or ScanLocation type
281
282 if "strip_path" in kwargs:
283 strip_path = kwargs["strip_path"]
284 elif str_loc.startswith(os.fspath(tempfile.gettempdir())):
285 strip_path = str_loc
286 else:
287 strip_path = self.strip_path
288
289 child = ScanLocation(
290 location=new_location,
291 metadata=metadata,
292 strip_path=strip_path,
293 parent=parent,
294 cleanup=kwargs.get("cleanup", False)
295 )
296
297 return child
298
299 def strip(self, target: Union[str, Path], include_parent: bool=True) -> str:
300 """

Callers 5

list_recursiveMethod · 0.95
scan_directoryMethod · 0.80
__export_blobMethod · 0.80
archive_analyzerFunction · 0.80
from_templateMethod · 0.80

Calls 3

ScanLocationClass · 0.85
popMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected