mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
tqdm auto-disabling with dynamic log level
This commit is contained in:
+6
-2
@@ -12,8 +12,7 @@ class Tqdm(tqdm):
|
||||
def __init__(
|
||||
self,
|
||||
iterable=None,
|
||||
disable=logging.getLogger(__name__).getEffectiveLevel()
|
||||
>= logging.CRITICAL,
|
||||
disable=None,
|
||||
bytes=False, # pylint: disable=W0622
|
||||
desc_truncate=None,
|
||||
**kwargs
|
||||
@@ -32,6 +31,11 @@ class Tqdm(tqdm):
|
||||
kwargs.setdefault(k, v)
|
||||
if desc_truncate is not None:
|
||||
kwargs.setdefault("desc", self.truncate(desc_truncate))
|
||||
if disable is None:
|
||||
disable = (
|
||||
logging.getLogger(__name__).getEffectiveLevel()
|
||||
>= logging.CRITICAL
|
||||
)
|
||||
super(Tqdm, self).__init__(
|
||||
iterable=iterable, disable=disable, **kwargs
|
||||
)
|
||||
|
||||
@@ -348,9 +348,7 @@ class RemoteLOCAL(RemoteBASE):
|
||||
cache = []
|
||||
path_infos = []
|
||||
names = []
|
||||
for md5, info in Tqdm(
|
||||
status_info.items(), desc="Analysing status"
|
||||
):
|
||||
for md5, info in Tqdm(status_info.items(), desc="Analysing status"):
|
||||
if info["status"] == status:
|
||||
cache.append(self.checksum_to_path_info(md5))
|
||||
path_infos.append(remote.checksum_to_path_info(md5))
|
||||
|
||||
Reference in New Issue
Block a user