# # # patch "tracvc/mtn/util.py" # from [0040de4d22a4d69c79972605b615881eb1b6ebd9] # to [12e273ddf36684f07f66b88aad0bf7ddda3879d3] # ============================================================ --- tracvc/mtn/util.py 0040de4d22a4d69c79972605b615881eb1b6ebd9 +++ tracvc/mtn/util.py 12e273ddf36684f07f66b88aad0bf7ddda3879d3 @@ -26,9 +26,7 @@ import re import re -NATSORT_BIT = re.compile(r'(\d+|\D+)') - def add_slash(path): """Prepend a slash. Throughout the this plugin, all paths including the root dir, start with a slash.""" @@ -73,12 +71,13 @@ def try_int(s): return s +NATSORT_BIT = re.compile(r'(0|[1-9][0-9]*|[^0-9]+)') + def natsort_key(s): """Generate the key for sorting strings naturally.""" + return [try_int(w) for w in NATSORT_BIT.findall(s)] - return [try_int(w) for w in re.findall(NATSORT_BIT, s)] - def to_unicode(s): """Convert s from utf-8 to unicode, thereby replacing unknown characters with the unicode replace char."""