diff options
author | hut <hut@lavabit.com> | 2010-11-01 15:38:16 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-11-01 15:38:37 +0100 |
commit | ba72fe26af4dc8fc1580ac0ea39b831e4368c881 (patch) | |
tree | ad217b1cf1aed16b008a5e13b6d3ad6a4ed25f66 /ranger | |
parent | a92f6409ab3a5d9bcf87639e5eedaf7c0c483eb6 (diff) | |
download | ranger-ba72fe26af4dc8fc1580ac0ea39b831e4368c881.tar.gz |
fsobject.fsobject: fixed natural sort with python3
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/fsobject/fsobject.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py index e513fc21..0e2b46f5 100644 --- a/ranger/fsobject/fsobject.py +++ b/ranger/fsobject/fsobject.py @@ -101,13 +101,13 @@ class FileSystemObject(FileManagerAware): @lazy_property def basename_natural(self): - return [int(c) if c.isdigit() else c or 0 \ - for c in _extract_number_re.split(self.basename)] + return [c if i % 3 == 1 else (int(c) if c else 0) for i, c in \ + enumerate(_extract_number_re.split(self.basename))] @lazy_property def basename_natural_lower(self): - return [int(c) if c.isdigit() else c or 0 \ - for c in _extract_number_re.split(self.basename_lower)] + return [c if i % 3 == 1 else (int(c) if c else 0) for i, c in \ + enumerate(_extract_number_re.split(self.basename_lower))] def __str__(self): """returns a string containing the absolute path""" |