Skip to content

Commit 1012279

Browse files
authored
fix: use [project.optional-dependencies] instead of [tool.poetry.extras] (#350)
* fix: use [project.optional-dependencies] instead of [tool.poetry.extras] * chore: fix black formatting * chore: fix ml extra section
1 parent 9f55a87 commit 1012279

5 files changed

Lines changed: 446 additions & 23 deletions

File tree

openfoodfacts/utils/__init__.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,17 @@ def download_file(url: str, output_path: Path):
190190
etag = r.headers.get("ETag", "").strip("'\"")
191191

192192
tmp_output_path = output_path.with_name(output_path.name + ".part")
193-
with tmp_output_path.open("wb") as f, tqdm.tqdm(
194-
unit="B",
195-
unit_scale=True,
196-
unit_divisor=1024,
197-
miniters=1,
198-
desc=str(output_path),
199-
total=int(r.headers.get("content-length", 0)),
200-
) as pbar:
193+
with (
194+
tmp_output_path.open("wb") as f,
195+
tqdm.tqdm(
196+
unit="B",
197+
unit_scale=True,
198+
unit_divisor=1024,
199+
miniters=1,
200+
desc=str(output_path),
201+
total=int(r.headers.get("content-length", 0)),
202+
) as pbar,
203+
):
201204
for chunk in r.iter_content(chunk_size=4096):
202205
f.write(chunk)
203206
pbar.update(len(chunk))

0 commit comments

Comments
 (0)