# Path: gala/iterprogress.py
# class NoProgressBar(object):
#     def __init__(self, *args, **kwargs): pass
#     def start(self, *args, **kwargs): pass
#     def update(self, *args, **kwargs): pass
#     def update_i(self, *args, **kwargs): pass
#     def finish(self, *args, **kwargs): pass
#     def set_title(self, *args, **kwargs): pass
# 
# class StandardProgressBar(object):
#     def __init__(self, title='Progress: '):
#         self.title = title
#         self.is_finished = False
# 
#     def start(self, total, widgets=None):
#         if widgets is None:
#             widgets = [self.title, RotatingMarker(), ' ',
#                         Percentage(), ' ', Bar(marker='='), ' ', ETA()]
#         self.pbar = ProgressBar(widgets=widgets, maxval=total)
#         self.pbar.start()
#         self.i = 0
# 
#     def update(self, step=1):
#         self.i += step
#         self.pbar.update(self.i)
#         if self.i == self.pbar.maxval:
#             self.finish()
# 
#     def update_i(self, value):
#         self.i = value
#         self.pbar.update(value)
#         if value == self.pbar.maxval:
#             self.finish()
# 
#     def finish(self):
#         if self.is_finished:
#             pass
#         else:
#             self.pbar.finish()
#             self.is_finished = True
# 
#     def set_title(self, title):
#         self.title = title


from heapq import heapify, heappush, heappop
from .iterprogress import NoProgressBar, StandardProgressBar


class MergeQueue(object):
    def __init__(self, items=[], length=None, with_progress=False, 
                                            prog_title='Agglomerating... '):
        if length is None:
            self.num_valid_items = len(items)
        else:
            self.num_valid_items = length
        self.original_length = self.num_valid_items
        self.q = items
        heapify(self.q)
        self.is_null_queue = len(items) == 0
        if with_progress:

# Path: gala/iterprogress.py
# class NoProgressBar(object):
#     def __init__(self, *args, **kwargs): pass
#     def start(self, *args, **kwargs): pass
#     def update(self, *args, **kwargs): pass
#     def update_i(self, *args, **kwargs): pass
#     def finish(self, *args, **kwargs): pass
#     def set_title(self, *args, **kwargs): pass
# 
# class StandardProgressBar(object):
#     def __init__(self, title='Progress: '):
#         self.title = title
#         self.is_finished = False
# 
#     def start(self, total, widgets=None):
#         if widgets is None:
#             widgets = [self.title, RotatingMarker(), ' ',
#                         Percentage(), ' ', Bar(marker='='), ' ', ETA()]
#         self.pbar = ProgressBar(widgets=widgets, maxval=total)
#         self.pbar.start()
#         self.i = 0
# 
#     def update(self, step=1):
#         self.i += step
#         self.pbar.update(self.i)
#         if self.i == self.pbar.maxval:
#             self.finish()
# 
#     def update_i(self, value):
#         self.i = value
#         self.pbar.update(value)
#         if value == self.pbar.maxval:
#             self.finish()
# 
#     def finish(self):
#         if self.is_finished:
#             pass
#         else:
#             self.pbar.finish()
#             self.is_finished = True
# 
#     def set_title(self, title):
#         self.title = title


# Path: gala/mergequeue.py
from heapq import heapify, heappush, heappop
from .iterprogress import NoProgressBar, StandardProgressBar



class MergeQueue(object):
    def __init__(self, items=[], length=None, with_progress=False, 
                                            prog_title='Agglomerating... '):
        if length is None:
            self.num_valid_items = len(items)
        else:
            self.num_valid_items = length
        self.original_length = self.num_valid_items
        self.q = items
        heapify(self.q)
        self.is_null_queue = len(items) == 0
        if with_progress:

            self.pbar = StandardProgressBar(prog_title)