MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / isArchived

Method isArchived

src/Content/ContentManager.py:354–370  ·  view source on GitHub ↗
(self, inner_path, modified)

Source from the content-addressed store, hash-verified

352
353 # Returns if file with the given modification date is archived or not
354 def isArchived(self, inner_path, modified):
355 match = re.match(r"(.*)/(.*?)/", inner_path)
356 if not match:
357 return False
358 user_contents_inner_path = match.group(1) + "/content.json"
359 relative_directory = match.group(2)
360
361 file_info = self.getFileInfo(user_contents_inner_path)
362 if file_info:
363 time_archived_before = file_info.get("archived_before", 0)
364 time_directory_archived = file_info.get("archived", {}).get(relative_directory, 0)
365 if modified <= time_archived_before or modified <= time_directory_archived:
366 return True
367 else:
368 return False
369 else:
370 return False
371
372 def isDownloaded(self, inner_path, hash_id=None):
373 if not hash_id:

Callers 4

verifyFileMethod · 0.95
updaterMethod · 0.80
testArchivedDownloadMethod · 0.80

Calls 2

getFileInfoMethod · 0.95
getMethod · 0.45

Tested by 2

testArchivedDownloadMethod · 0.64