in atr/tasks/checks/zipformat.py [0:0]
def _license_files_check_file_zip(zf: zipfile.ZipFile, artifact_path: str, expected_path: str) -> tuple[bool, bool]:
"""Check for the presence and basic validity of a specific file in a zip."""
found = False
valid = False
try:
with zf.open(expected_path) as file_handle:
found = True
content = file_handle.read().strip()
if content:
# TODO: Add more specific NOTICE checks if needed
valid = True
except KeyError:
# File not found in zip
...
except Exception as e:
filename = os.path.basename(expected_path)
_LOGGER.warning(f"Error reading {filename} in zip {artifact_path}: {e}")
return found, valid