Esempio n. 1
0
def list_dir_file_info_sorted(dirpath):
    result = []
    for filename in os.listdir(dirpath):
        try:
            result.append(get_file_info(dirpath, filename))
        except OSError:
            pass
    result.sort(key=lambda info: natural_order_key(info.filename))
    return result
Esempio n. 2
0
 def __gt__(self, other):
     if not isinstance(other, FSNode):
         raise TypeError()
     if self.type != other.type:
         return self.type == 'f' and other.type == 'd'
     return natural_order_key(self.label) > natural_order_key(other.label)
Esempio n. 3
0
 def SortLinesNaturalOrder(self):
     self.SelectLines()
     lines = self.GetSelectedText().split("\n")
     lines.sort(key=lambda x: natural_order_key(x.strip()))
     self.ReplaceSelectionAndSelect("\n".join(lines))