MCPcopy Create free account
hub / github.com/ActiveState/code / getLargest

Method getLargest

recipes/Python/259147_FSList/recipe-259147.py:178–195  ·  view source on GitHub ↗

Returns the largest file. Yes, this is ugly.

(self)

Source from the content-addressed store, hash-verified

176 return fname
177
178 def getLargest(self):
179 """
180 Returns the largest file. Yes, this is ugly.
181 """
182 flist_copy = []
183 try:
184 flist_copy = zip(map(os.path.getsize, self), self)
185 except TypeError:
186 # there may be lists of lists
187 temp = self._unwind()
188 flist_copy = zip(map(os.path.getsize, temp), temp)
189 flist_copy.sort()
190 try:
191 size, fname = flist_copy[(len(flist_copy)-1)]
192 except IndexError:
193 # probably an empty list
194 return None
195 return fname
196
197 def getOldest(self):
198 """

Callers

nothing calls this directly

Calls 3

_unwindMethod · 0.95
mapFunction · 0.85
sortMethod · 0.45

Tested by

no test coverage detected