Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: client/third_party/chromium/natsort.py

Issue 2013943002: Changing license header, again! (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Intelligent natural sort implementation.""" 5 """Intelligent natural sort implementation."""
6 6
7 import re 7 import re
8 8
9 9
10 def natcmp(a, b): 10 def natcmp(a, b):
11 """Natural string comparison, case sensitive.""" 11 """Natural string comparison, case sensitive."""
12 try_int = lambda s: int(s) if s.isdigit() else s 12 try_int = lambda s: int(s) if s.isdigit() else s
13 def natsort_key(s): 13 def natsort_key(s):
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 >>> natsorted(['3A2', '3a1'], cmp=naticasecmp) 65 >>> natsorted(['3A2', '3a1'], cmp=naticasecmp)
66 ['3a1', '3A2'] 66 ['3a1', '3A2']
67 >>> natsorted(['3a2', '3A1'], cmp=naticasecmp) 67 >>> natsorted(['3a2', '3A1'], cmp=naticasecmp)
68 ['3A1', '3a2'] 68 ['3A1', '3a2']
69 >>> natsorted(['3A2', '3a1']) 69 >>> natsorted(['3A2', '3a1'])
70 ['3A2', '3a1'] 70 ['3A2', '3a1']
71 >>> natsorted(['3a2', '3A1']) 71 >>> natsorted(['3a2', '3A1'])
72 ['3A1', '3a2'] 72 ['3A1', '3a2']
73 """ 73 """
74 return sorted(seq, cmp=cmp, *args, **kwargs) 74 return sorted(seq, cmp=cmp, *args, **kwargs)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698