Apply yapf formatting to all Python files (issue #2171)

This commit is contained in:
Marshall Greenblatt
2017-05-28 15:04:18 +02:00
parent 59606b88d2
commit 12150b43d2
34 changed files with 5101 additions and 4557 deletions

View File

@@ -14,14 +14,36 @@ import sys
import os
module_order = [
"_sse", "-sse", "_ssse", "-ssse",
"_sse2", "-sse2", "_ssse2", "-ssse2",
"_sse3", "-sse3", "_ssse3", "-ssse3",
"_sse4", "-sse4", "_ssse4", "-ssse4",
"_avx", "-avx", "_savx", "-savx",
"_avx1", "-avx1", "_savx1", "-savx1",
"_avx2", "-avx2", "_savx2", "-savx2",
]
"_sse",
"-sse",
"_ssse",
"-ssse",
"_sse2",
"-sse2",
"_ssse2",
"-ssse2",
"_sse3",
"-sse3",
"_ssse3",
"-ssse3",
"_sse4",
"-sse4",
"_ssse4",
"-ssse4",
"_avx",
"-avx",
"_savx",
"-savx",
"_avx1",
"-avx1",
"_savx1",
"-savx1",
"_avx2",
"-avx2",
"_savx2",
"-savx2",
]
def get_obj_class(item):
item = item.lower()
@@ -31,12 +53,16 @@ def get_obj_class(item):
return 1 + i
return 0
def obj_compare(x, y):
xc = get_obj_class(x)
yc = get_obj_class(y)
if xc < yc: return -1
elif xc > yc: return 1
else: return 0
if xc < yc:
return -1
elif xc > yc:
return 1
else:
return 0
def process_line(line):
@@ -50,7 +76,7 @@ def process_line(line):
objects = part2[:stampsIndex]
objects_list = objects.split()
objects_list = sorted(objects_list, cmp = obj_compare)
objects_list = sorted(objects_list, cmp=obj_compare)
return part1 + " " + " ".join(objects_list) + " " + stamps
return line
@@ -70,5 +96,6 @@ def process_file(path):
f.write("\n".join(result))
f.write("\n")
def apply(confpath):
process_file(os.path.join(confpath, "obj", "cef", "libcef.ninja"))