Download a zstd-compressed CSV from a local path. If the file doesn't exist, returns an empty list.
(local_path: str)
| 120 | |
| 121 | |
| 122 | def download_zstd_csv_local(local_path: str) -> List[str]: |
| 123 | """ |
| 124 | Download a zstd-compressed CSV from a local path. |
| 125 | If the file doesn't exist, returns an empty list. |
| 126 | """ |
| 127 | if not os.path.exists(local_path): |
| 128 | return [] |
| 129 | |
| 130 | if not zstandard: |
| 131 | raise RuntimeError("zstandard package is required for local zstd CSV operations.") |
| 132 | |
| 133 | with open(local_path, "rb") as f: |
| 134 | dctx = zstandard.ZstdDecompressor() |
| 135 | data = dctx.decompress(f.read()) |
| 136 | lines = data.decode("utf-8").splitlines() |
| 137 | return lines |
| 138 | |
| 139 | |
| 140 | def upload_zstd_csv_local(local_path: str, lines: List[str]) -> None: |
nothing calls this directly
no outgoing calls
no test coverage detected