Skip to content

Commit

Permalink
Merge pull request #49 from metno/47-disable-tqdm-when-running-non-in…
Browse files Browse the repository at this point in the history
…teractive

47 disable tqdm when running non interactive
  • Loading branch information
jgriesfeller authored Sep 11, 2024
2 parents 80f5a1f + e8dd220 commit df8e962
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ def __init__(
lines = []
_fidx = 0
members = tf.getmembers()
bar = tqdm(desc="extracting tar file...", total=len(members))
bar = tqdm(
desc="extracting tar file...",
total=len(members),
disable=None,
)
for _midx, member in enumerate(members):
if fnmatch(member.name, FILE_MASK):
bar.update(1)
Expand Down Expand Up @@ -171,7 +175,7 @@ def __init__(

gcd = Geocoder_Reverse_NE()
crd = csv.DictReader(lines, fieldnames=self._fields, delimiter=DELIMITER)
bar = tqdm(desc=tqdm_desc, total=len(lines))
bar = tqdm(desc=tqdm_desc, total=len(lines), disable=None)
for _ridx, row in enumerate(crd):
bar.update(1)
if row[SITE_NAME] != _laststatstr:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __init__(

gcd = Geocoder_Reverse_NE()
crd = csv.DictReader(lines, fieldnames=self._fields, delimiter=DELIMITER)
bar = tqdm(desc=tqdm_desc, total=len(lines))
bar = tqdm(desc=tqdm_desc, total=len(lines), disable=None)
for _ridx, row in enumerate(crd):
bar.update(1)
if row[SITE_NAME] != _laststatstr:
Expand Down
2 changes: 1 addition & 1 deletion src/pyaro_readers/harpreader/harpreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(
else:
self._files.append(file)

bar = tqdm(total=len(self._files))
bar = tqdm(total=len(self._files), disable=None)

for f_idx, _file in enumerate(self._files):
logger.info(f"Reading {_file}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(
raise ValueError(
f"Could not find any nas files in given folder {self._filename}"
)
bar = tqdm(desc=tqdm_desc, total=len(files))
bar = tqdm(desc=tqdm_desc, total=len(files), disable=None)
for file in files:
bar.update(1)
self._process_file(file, fill_country_flag)
Expand Down
2 changes: 1 addition & 1 deletion src/pyaro_readers/nilupmfebas/EbasPmfReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __init__(
if Path(realpath).is_dir():
# search directory for files
files = list(realpath.glob(filemask))
bar = tqdm(desc=tqdm_desc, total=len(files))
bar = tqdm(desc=tqdm_desc, total=len(files), disable=None)

for _ridx, file in enumerate(files):
bar.update(1)
Expand Down

0 comments on commit df8e962

Please sign in to comment.