Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/qlever/commands/update_wikidata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import logging
import os
import re
import shutil
import signal
import sys
import time
from datetime import datetime, timezone
from enum import Enum, auto
Expand Down Expand Up @@ -716,12 +718,23 @@ def execute(self, args) -> bool:

# Process one event at a time (unless using cached file).
if not use_cached_file:
# The width of the progress bar: dynamic on a terminal;
# when the output is piped (for example, through `tee`),
# `tqdm` cannot detect the terminal width and falls back to
# a bar of only 10 characters, so use the width from the
# `COLUMNS` environment variable (or 80) instead.
ncols = (
None
if sys.stderr.isatty()
else shutil.get_terminal_size().columns
)
with tqdm_logging_redirect(
loggers=[logging.getLogger("qlever")],
desc="Batch",
total=args.batch_size,
leave=False,
bar_format="{l_bar}{bar}| {n_fmt}/{total_fmt}{postfix}",
ncols=ncols,
) as pbar:
for event in self.iter_sse_events(source):
# Skip events that are not of type `message` (should not
Expand Down
Loading