From f2e013241d882818467558a6fe6c139bebf80279 Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Sun, 4 Mar 2018 14:47:39 +0100 Subject: [PATCH] Add tqdm partial to utilities --- fimfarchive/utils.py | 13 +++++++++++++ requirements.txt | 1 + setup.py | 1 + 3 files changed, 15 insertions(+) diff --git a/fimfarchive/utils.py b/fimfarchive/utils.py index 1688d05..633948c 100644 --- a/fimfarchive/utils.py +++ b/fimfarchive/utils.py @@ -25,9 +25,12 @@ Various utilities. import json import os import shutil +from functools import partial from typing import Any, Dict, Optional, Type, TypeVar, Union from pkg_resources import resource_string +from tqdm import tqdm + from fimfarchive.flavors import Flavor from fimfarchive.stories import Story @@ -36,12 +39,22 @@ __all__ = ( 'Empty', 'PersistedDict', 'find_flavor', + 'tqdm', ) F = TypeVar('F', bound=Flavor) +tqdm = partial( + tqdm, + ascii=True, + leave=False, + smoothing=0, + ncols=72, +) + + class EmptyMeta(type): """ Meta-class for Empty. diff --git a/requirements.txt b/requirements.txt index 4082f35..0c3a253 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,3 +7,4 @@ jmespath mypy pytest requests +tqdm diff --git a/setup.py b/setup.py index 8e8dd60..b0a30b9 100755 --- a/setup.py +++ b/setup.py @@ -91,5 +91,6 @@ setup( 'boltons', 'jmespath', 'requests', + 'tqdm', ), )