3 # vim: sw=4 ts=4 expandtab ai
4 # pylint: disable-msg=C0301
6 class SearchFile(object):
8 def filesorter(self, dir):
10 # Проходим по всем папкам вглубь от заданного пути
11 for dirpath, dirname, names in os.walk(dir):
13 flpath = os.path.join(dirpath, name)
14 # Возвращаем размер и полный путь файла
15 yield (os.path.getsize(flpath), flpath)
21 for fsize, fpath in heapq.nlargest(self.count, self.filesorter(self.path)):
22 file.add(fpath, fsize)
25 def __init__(self, input, config, ui):
26 self.path, self.count = input.get_st_par()
28 self.path = config.get("default_start_dir")
30 self.count = config.get("default_count")