Skip to content

Commit 589cfc5

Browse files
committed
Ignore sorting of GL Strings for smart sorts
1 parent 7dafdfd commit 589cfc5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pyard/smart_sort.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import re
2626

2727
expr_regex = re.compile('[NQLSGg]')
28+
glstring_chars = re.compile('[/|+^~]')
2829

2930

3031
@functools.lru_cache(maxsize=1000)
@@ -43,6 +44,10 @@ def smart_sort_comparator(a1, a2):
4344
if a1 == a2:
4445
return 0
4546

47+
# Ignore GL String matches
48+
if re.search(glstring_chars, a1) or re.search(glstring_chars, a2):
49+
return 0
50+
4651
# remove any non-numerics
4752
a1 = re.sub(expr_regex, '', a1)
4853
a2 = re.sub(expr_regex, '', a2)
@@ -92,4 +97,3 @@ def smart_sort_comparator(a1, a2):
9297

9398
# All fields are considered equal after 4th field
9499
return 0
95-

0 commit comments

Comments
 (0)