Test Formatter 1st commit
This commit is contained in:
parent
0403c4be31
commit
3d59aa4809
13 changed files with 925 additions and 0 deletions
15
judge/views/tf_utils.py
Normal file
15
judge/views/tf_utils.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
def get_char_kind(char):
|
||||
return 1 if char.isdigit() else 2 if char.isalpha() else 3
|
||||
|
||||
|
||||
def natural_sorting_key(name):
|
||||
result = []
|
||||
last_kind = -1
|
||||
for char in name:
|
||||
curr_kind = get_char_kind(char)
|
||||
if curr_kind != last_kind:
|
||||
result.append("")
|
||||
result[-1] += char
|
||||
last_kind = curr_kind
|
||||
|
||||
return [x.zfill(16) if x.isdigit() else x for x in result]
|
Loading…
Add table
Add a link
Reference in a new issue