Skip to content

Commit

Permalink
Merge pull request #640 from voxel51/main
Browse files Browse the repository at this point in the history
Merging main
  • Loading branch information
brimoor authored Dec 20, 2024
2 parents 6904041 + 794b677 commit f45e571
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions eta/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ def __init__(

num_pct_decimals = 0

self._total = self._get_total(total)
self._total = self._get_total(total, quiet)
self._iterator = None
self._iteration = 0
self._show_percentage = show_percentage
Expand Down Expand Up @@ -1673,10 +1673,7 @@ def __len__(self):

def __call__(self, iterable):
if self._total is None:
try:
self._total = len(iterable)
except:
self._total = None
self._total = self._get_total(iterable, self._quiet)

if self._total is None:
self._show_remaining_time = False
Expand Down Expand Up @@ -1926,10 +1923,14 @@ def draw(self, force=False):
self._draw(force=force)

@staticmethod
def _get_total(total):
def _get_total(total, quiet):
if is_numeric(total) or total is None:
return total

if quiet:
# Don't compute `len()` unnecessarily
return None

try:
return len(total)
except:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from wheel.bdist_wheel import bdist_wheel


VERSION = "0.13.0"
VERSION = "0.13.1"


class BdistWheelCustom(bdist_wheel):
Expand Down Expand Up @@ -140,7 +140,7 @@ def get_version():
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
"Programming Language :: Python :: 3.11",
],
entry_points={"console_scripts": ["eta=eta.core.cli:main"]},
python_requires=">=3.9",
Expand Down

0 comments on commit f45e571

Please sign in to comment.