in atr/tasks/checks/zipformat.py [0:0]
def _integrity_check_core_logic(artifact_path: str) -> dict[str, Any]:
"""Verify that a zip file can be opened and its members listed."""
try:
with zipfile.ZipFile(artifact_path, "r") as zf:
# This is a simple check using list members
# We can use zf.testzip() for CRC checks if needed, though this will be slower
member_list = zf.namelist()
return {"member_count": len(member_list)}
except zipfile.BadZipFile as e:
return {"error": f"Bad zip file: {e}"}
except FileNotFoundError:
return {"error": "File not found"}
except Exception as e:
return {"error": f"Unexpected error: {e}"}