Compare commits
No commits in common. "main" and "v0.2.2" have entirely different histories.
@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "dopt-basics"
|
name = "dopt-basics"
|
||||||
version = "0.2.4"
|
version = "0.2.2"
|
||||||
description = "basic cross-project tools for Python-based d-opt projects"
|
description = "basic cross-project tools for Python-based d-opt projects"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Florian Förster", email = "f.foerster@d-opt.com"},
|
{name = "Florian Förster", email = "f.foerster@d-opt.com"},
|
||||||
@ -69,7 +69,7 @@ directory = "reports/coverage"
|
|||||||
|
|
||||||
|
|
||||||
[tool.bumpversion]
|
[tool.bumpversion]
|
||||||
current_version = "0.2.4"
|
current_version = "0.2.2"
|
||||||
parse = """(?x)
|
parse = """(?x)
|
||||||
(?P<major>0|[1-9]\\d*)\\.
|
(?P<major>0|[1-9]\\d*)\\.
|
||||||
(?P<minor>0|[1-9]\\d*)\\.
|
(?P<minor>0|[1-9]\\d*)\\.
|
||||||
|
|||||||
@ -24,7 +24,6 @@ class LoadingAnimation:
|
|||||||
self.ending_text = ending_text
|
self.ending_text = ending_text
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.done: bool = False
|
self.done: bool = False
|
||||||
self.keyboard_interrupt: bool = False
|
|
||||||
|
|
||||||
self._isatty = sys.stdout.isatty()
|
self._isatty = sys.stdout.isatty()
|
||||||
self._do_animation = bool(sys.stdout.isatty())
|
self._do_animation = bool(sys.stdout.isatty())
|
||||||
@ -54,15 +53,16 @@ class LoadingAnimation:
|
|||||||
exc_type: type[Exception],
|
exc_type: type[Exception],
|
||||||
exc_value,
|
exc_value,
|
||||||
tb,
|
tb,
|
||||||
) -> None:
|
) -> bool:
|
||||||
if exc_type is not None:
|
if exc_type is not None:
|
||||||
self.stop(interrupt=True)
|
self.stop(interrupt=True)
|
||||||
if exc_type is KeyboardInterrupt:
|
if exc_type is KeyboardInterrupt:
|
||||||
self.keyboard_interrupt = True
|
|
||||||
print("Operation cancelled by user. (KeyboardInterrupt)", flush=True)
|
print("Operation cancelled by user. (KeyboardInterrupt)", flush=True)
|
||||||
return
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
self.stop()
|
self.stop()
|
||||||
|
return False
|
||||||
|
|
||||||
def _animation(self) -> None:
|
def _animation(self) -> None:
|
||||||
for frame in cycle(self.frames):
|
for frame in cycle(self.frames):
|
||||||
@ -81,9 +81,6 @@ class LoadingAnimation:
|
|||||||
self,
|
self,
|
||||||
interrupt: bool = False,
|
interrupt: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
if self.done:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.done = True
|
self.done = True
|
||||||
if self._do_animation:
|
if self._do_animation:
|
||||||
self._thread.join()
|
self._thread.join()
|
||||||
@ -103,6 +100,6 @@ def default_loading(func: Callable[P, T]) -> Callable[P, T]:
|
|||||||
with LoadingAnimation(loading_txt, ending_text):
|
with LoadingAnimation(loading_txt, ending_text):
|
||||||
res = func(*args, **kwargs)
|
res = func(*args, **kwargs)
|
||||||
|
|
||||||
return res
|
return res # type: ignore
|
||||||
|
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user