Skip to content

Feature/spinner time #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions foliant/utils.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
'''Various utilities used here and there in the Foliant code.'''

import pkg_resources
import time

from contextlib import contextmanager
from pkgutil import iter_modules
from importlib import import_module
from logging import Logger
from pathlib import Path
from pkgutil import iter_modules
from shutil import rmtree
from traceback import format_exc
from pathlib import Path
from logging import Logger
from typing import List, Dict, Tuple, Type, Set
import pkg_resources
from typing import Dict
from typing import List
from typing import Set
from typing import Tuple
from typing import Type


def get_available_tags() -> Set[str]:
Expand Down Expand Up @@ -150,6 +156,7 @@ def spinner(text: str, logger: Logger, quiet=False, debug=False):
# pylint: disable=broad-except

try:
starttime = time.time()
logger.info(text)

if not quiet:
Expand All @@ -158,7 +165,8 @@ def spinner(text: str, logger: Logger, quiet=False, debug=False):
yield

if not quiet:
print('Done', flush=True)
elapsed = round(time.time() - starttime, 3)
print(f'Done in {elapsed}s', flush=True)

except Exception as exception:
exception_traceback = format_exc()
Expand Down