def members(archive: pathlib.Path): import rarfile with archive.open('rb') as f, rarfile.RarFile(f) as archive: return (pathlib.PurePath(info.filename) for info in archive.infolist() if not info.isfdir())
def members(archive: pathlib.Path): import zipfile with archive.open('rb') as f, zipfile.ZipFile(f) as archive: return (pathlib.PurePath(info.filename) for info in archive.infolist() if not info.filename.endswith('/'))