Skip to content

Commit 2a9fa27

Browse files
authored
Better name for gz unzipping function (#295)
1 parent 228f1f4 commit 2a9fa27

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Remove unused dependencies [#292](https://github.com/datagouv/hydra/pull/292)
77
- Fill in check throughout the process to send previous steps infos in case of late crash [#293](https://github.com/datagouv/hydra/pull/293)
88
- Fix purge csv tables CLI by using the csv db connection [#294](https://github.com/datagouv/hydra/pull/294)
9+
- Better gz files extraction function name [#295](https://github.com/datagouv/hydra/pull/295)
910

1011
## 2.3.0 (2025-07-15)
1112

udata_hydra/utils/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from .auth import token_auth_middleware
22
from .csv import detect_tabular_from_headers
33
from .errors import IOException, ParseException, handle_parse_exception
4-
from .file import compute_checksum_from_file, download_resource, read_csv_gz, remove_remainders
4+
from .file import compute_checksum_from_file, download_resource, extract_gzip, remove_remainders
55
from .geojson import detect_geojson_from_headers_or_catalog
66
from .http import UdataPayload, get_request_params, send
77
from .queue import enqueue
@@ -15,7 +15,7 @@
1515
"handle_parse_exception",
1616
"compute_checksum_from_file",
1717
"download_resource",
18-
"read_csv_gz",
18+
"extract_gzip",
1919
"remove_remainders",
2020
"detect_geojson_from_headers_or_catalog",
2121
"UdataPayload",

udata_hydra/utils/file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def compute_checksum_from_file(filename: str) -> str:
2525
return sha1sum.hexdigest()
2626

2727

28-
def read_csv_gz(file_path: str) -> IO[bytes]:
28+
def extract_gzip(file_path: str) -> IO[bytes]:
2929
with gzip.open(file_path, "rb") as gz_file:
3030
with tempfile.NamedTemporaryFile(mode="wb", delete=False) as temp_file:
3131
temp_file.write(gz_file.read())
@@ -78,7 +78,7 @@ async def download_resource(
7878
"application/x-gzip",
7979
"application/gzip",
8080
]:
81-
tmp_file = read_csv_gz(tmp_file.name)
81+
tmp_file = extract_gzip(tmp_file.name)
8282
return tmp_file
8383

8484

0 commit comments

Comments
 (0)