Skip to content

Commit

Permalink
V1.6.5 (#169)
Browse files Browse the repository at this point in the history
* fixes: fix progress on iter exit.

* improves: add progress on unzip

* release: improves and fixes
  • Loading branch information
jlsneto authored Mar 25, 2022
1 parent 1378c25 commit cc5a9f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cereja/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from ._requests import request


VERSION = "1.6.4.final.0"
VERSION = "1.6.5.final.0"


__version__ = get_version_pep440_compliant(VERSION)
Expand Down
18 changes: 9 additions & 9 deletions cereja/display/_display.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@

__all__ = ['Progress', "State", "console"]

from cereja.utils.decorators import singleton

_exclude = ["_Stdout", "ConsoleBase", "BaseProgress", "ProgressLoading", "ProgressBar",
"ProgressLoadingSequence", "State"]

Expand Down Expand Up @@ -750,8 +748,8 @@ def _progress_service(self):
self._show_progress(self._current_value)
last_value = self._current_value
time.sleep(0.01)
if not self._was_done:
self._show_progress(self._max_value)
# if not self._was_done:
# self._show_progress(self._max_value)

def _show_progress(self, for_value=None):
self._awaiting_update = False
Expand Down Expand Up @@ -856,11 +854,13 @@ def __call__(self, sequence: Sequence, name=None) -> "Progress":
def __next__(self):
if not self._with_context:
self.start()
for n, obj in enumerate(self.sequence):
self._update_value(n + 1)
yield obj
if not self._with_context:
self.stop()
try:
for n, obj in enumerate(self.sequence):
self._update_value(n + 1)
yield obj
finally:
if not self._with_context:
self.stop()
self._console.set_prefix(self.name)
self.sequence = ()

Expand Down
4 changes: 3 additions & 1 deletion cereja/file/_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from io import BytesIO
from typing import Any, List, Union, Type, TextIO, Iterable, Tuple, KeysView, ItemsView, ValuesView
import json

import cereja
from .._requests import request
from zipfile import ZipFile, ZIP_DEFLATED

Expand Down Expand Up @@ -765,7 +767,7 @@ def unzip(cls, file_path, save_on: str = None, members: List = None, k=None, is_
members = members or sample(myzip.namelist(), k, is_random)
if save_on:
mkdir(save_on)
myzip.extractall(save_on, members=members)
myzip.extractall(save_on, members=cereja.Progress.prog(list(members), 'Extracting'))

def _save_fp(self, fp: Union[TextIO, BytesIO]) -> None:
raise NotImplementedError
Expand Down

0 comments on commit cc5a9f5

Please sign in to comment.