def current(cls, name): result = cls(name, datetime.datetime.now()) for i, u in enumerate(iter_usage_with_progress()): u.ensure_category() u.ensure_hexdump() result._add_usage(u) return result
def __iter__(self): from heap import iter_usage_with_progress, lazily_get_usage_list if True: # 2-pass, but the expensive first pass may be cached usage_list = lazily_get_usage_list() for u in usage_list: if self.filter_.eval_(u): yield u else: # 1-pass: # This may miss blocks that are only categorized w.r.t. to other # blocks: for u in iter_usage_with_progress(): if self.filter_.eval_(u): yield u