replace progressbar by tqdm

This commit is contained in:
Fabian 2023-02-22 14:12:26 +01:00
parent ec4191fa51
commit 825d3e84d2
2 changed files with 10 additions and 12 deletions

View File

@ -33,7 +33,6 @@ dependencies:
- networkx - networkx
- scipy - scipy
- shapely>=2.0 - shapely>=2.0
- progressbar2
- pyomo - pyomo
- matplotlib<3.6 - matplotlib<3.6
- proj - proj

View File

@ -4,7 +4,8 @@
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
from pathlib import Path from pathlib import Path
import urllib
from tqdm import tqdm
import pandas as pd import pandas as pd
REGION_COLS = ["geometry", "name", "x", "y", "country"] REGION_COLS = ["geometry", "name", "x", "y", "country"]
@ -251,16 +252,14 @@ def aggregate_costs(n, flatten=False, opts=None, existing_only=False):
def progress_retrieve(url, file): def progress_retrieve(url, file):
import urllib
with tqdm(unit='B', unit_scale=True, unit_divisor=1024, miniters=1, position=0, leave=True) as t:
from progressbar import ProgressBar def update_to(b=1, bsize=1, tsize=None):
if tsize is not None:
pbar = ProgressBar(0, 100) t.total = tsize
t.update(b * bsize - t.n)
def dlProgress(count, blockSize, totalSize):
pbar.update(int(count * blockSize * 100 / totalSize)) urllib.request.urlretrieve(url, file, reporthook=update_to)
urllib.request.urlretrieve(url, file, reporthook=dlProgress)
def get_aggregation_strategies(aggregation_strategies): def get_aggregation_strategies(aggregation_strategies):