Returns the smallest file. Yes, this is ugly.
(self)
| 157 | return totsize |
| 158 | |
| 159 | def getSmallest(self): |
| 160 | """ |
| 161 | Returns the smallest file. Yes, this is ugly. |
| 162 | """ |
| 163 | flist_copy = [] |
| 164 | try: |
| 165 | flist_copy = zip(map(os.path.getsize, self), self) |
| 166 | except TypeError: |
| 167 | # there may be lists of lists |
| 168 | temp = self._unwind() |
| 169 | flist_copy = zip(map(os.path.getsize, temp), temp) |
| 170 | flist_copy.sort() |
| 171 | try: |
| 172 | size, fname = flist_copy[0] |
| 173 | except IndexError: |
| 174 | # probably an empty list |
| 175 | return None |
| 176 | return fname |
| 177 | |
| 178 | def getLargest(self): |
| 179 | """ |