def make_gui(self): """Test""" self.view = view.MainApp() self.view.register(self) self.view.root.title(self.appname) self.view.create_tabs(self.tablist) self.view.create_bottom_bar() self.view.set_statusbar(" ".join((self.appname, 'ver.', self.version)))
def setUp(self): # self.r = tk.Tk() view.tk.Tk = mock.Mock() view.MainApp.create_widgets = mock.Mock() self.mw = view.MainApp()
tmp = src_copy.pop() while tmp >= minimum: result.append(tmp) tmp = src_copy.pop() return cycle(result) if result else None # None if no results def remove(source, minimum=0.0, maximum=1.0): source.pop() return source def useful_info(heap): """ :type heap: Heap """ return "Depth: " + str(heap.depth) def emptyType(): return Heap() if __name__ == "__main__": parser = parserLastFM.parser("LastFM_small.dat") app = view.MainApp(parser, add, search, remove, useful_info, emptyType()) app.mainloop()
assert 0 <= maximum <= 1 assert minimum <= maximum result = PQueue() queueCopy = copy(queue) value = queueCopy.dequeue() while value is not None and value > maximum: result.enqueue(value) # append to results value = queueCopy.dequeue() # next value while value is not None and value.relevance >= minimum: # higher than min (and lower than max) => remove value = queueCopy.dequeue() # next value while value is not None: # below minimum until bottom... result.enqueue(value) # append to results value = queueCopy.dequeue() # next value return result def initParser(filename): return parserLastFM.parser(filename, PQueue()) if __name__ == "__main__": users = PQueue() parser = initParser('LastFM_small.dat') app = view.MainApp(parser, add, search, remove, users) app.mainloop()
result = emptyType() userscopy = copy( users ) #users is pased by reference, this is to safely operate through users value = userscopy.dequeue() while value is not None: #iterate over users until we reach the last user if low <= value.relevance() <= high: #matches result.enqueue(value) value = userscopy.dequeue() #next value return result def get_next(queue): return queue.dequeue() def initparser(filename): return parserLastFM.parser(filename, Queue) def emptyType(): '''returns an empty instance of class Queue''' return Queue() if __name__ == '__main__': parser = initparser('LastFM_small.dat') app = view.MainApp(parser, add, search, get_next, emptyType()) app.mainloop()