Skip to content
Snippets Groups Projects
Commit b88d0281 authored by Dennis Noll's avatar Dennis Noll
Browse files

[data] DSS: map now supports tqdm status bar

parent 44e942b7
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,8 @@ import tensorflow as tf
from operator import itemgetter
from os import listdir, path, remove
from tqdm.auto import tqdm
class SKDict(dict):
@staticmethod
......@@ -56,10 +58,11 @@ class SKDict(dict):
def copy(self):
return self.__class__(self)
def map(self, func, groups=None):
def map(self, func, groups=None, **tqdm_kwargs):
if groups is None:
groups = self.keys()
return self.__class__({g: func(self[g]) for g in map(self.keyify, groups)})
wrap = lambda x: tqdm(x, **tqdm_kwargs) if tqdm_kwargs else lambda x: x
return self.__class__({g: func(self[g]) for g in map(self.keyify, wrap(groups))})
@classmethod
def zip(cls, *insts):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment