Cleanup: pep8
This commit is contained in:
@@ -39,8 +39,6 @@ from cmake_consistency_check_config import (
|
|||||||
import os
|
import os
|
||||||
from os.path import join, dirname, normpath, splitext
|
from os.path import join, dirname, normpath, splitext
|
||||||
|
|
||||||
print("Scanning:", SOURCE_DIR)
|
|
||||||
|
|
||||||
global_h = set()
|
global_h = set()
|
||||||
global_c = set()
|
global_c = set()
|
||||||
global_refs = {}
|
global_refs = {}
|
||||||
@@ -211,7 +209,7 @@ def cmake_get_src(f):
|
|||||||
if new_path_rel != l:
|
if new_path_rel != l:
|
||||||
print("overly relative path:\n %s:%d\n %s\n %s" % (f, i, l, new_path_rel))
|
print("overly relative path:\n %s:%d\n %s\n %s" % (f, i, l, new_path_rel))
|
||||||
|
|
||||||
## Save time. just replace the line
|
# # Save time. just replace the line
|
||||||
# replace_line(f, i - 1, new_path_rel)
|
# replace_line(f, i - 1, new_path_rel)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -242,10 +240,6 @@ def cmake_get_src(f):
|
|||||||
filen.close()
|
filen.close()
|
||||||
|
|
||||||
|
|
||||||
for cmake in source_list(SOURCE_DIR, is_cmake):
|
|
||||||
cmake_get_src(cmake)
|
|
||||||
|
|
||||||
|
|
||||||
def is_ignore(f):
|
def is_ignore(f):
|
||||||
for ig in IGNORE:
|
for ig in IGNORE:
|
||||||
if ig in f:
|
if ig in f:
|
||||||
@@ -253,11 +247,18 @@ def is_ignore(f):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
# First do stupid check, do these files exist?
|
def main():
|
||||||
print("\nChecking for missing references:")
|
|
||||||
is_err = False
|
print("Scanning:", SOURCE_DIR)
|
||||||
errs = []
|
|
||||||
for f in (global_h | global_c):
|
for cmake in source_list(SOURCE_DIR, is_cmake):
|
||||||
|
cmake_get_src(cmake)
|
||||||
|
|
||||||
|
# First do stupid check, do these files exist?
|
||||||
|
print("\nChecking for missing references:")
|
||||||
|
is_err = False
|
||||||
|
errs = []
|
||||||
|
for f in (global_h | global_c):
|
||||||
if f.startswith(BUILD_DIR):
|
if f.startswith(BUILD_DIR):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -270,22 +271,22 @@ for f in (global_h | global_c):
|
|||||||
raise Exception("CMake referenecs missing, internal error, aborting!")
|
raise Exception("CMake referenecs missing, internal error, aborting!")
|
||||||
is_err = True
|
is_err = True
|
||||||
|
|
||||||
errs.sort()
|
errs.sort()
|
||||||
errs.reverse()
|
errs.reverse()
|
||||||
for cf, i in errs:
|
for cf, i in errs:
|
||||||
print("%s:%d" % (cf, i))
|
print("%s:%d" % (cf, i))
|
||||||
# Write a 'sed' script, useful if we get a lot of these
|
# Write a 'sed' script, useful if we get a lot of these
|
||||||
# print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf))
|
# print("sed '%dd' '%s' > '%s.tmp' ; mv '%s.tmp' '%s'" % (i, cf, cf, cf, cf))
|
||||||
|
|
||||||
|
|
||||||
if is_err:
|
if is_err:
|
||||||
raise Exception("CMake referenecs missing files, aborting!")
|
raise Exception("CMake referenecs missing files, aborting!")
|
||||||
del is_err
|
del is_err
|
||||||
del errs
|
del errs
|
||||||
|
|
||||||
# now check on files not accounted for.
|
# now check on files not accounted for.
|
||||||
print("\nC/C++ Files CMake doesnt know about...")
|
print("\nC/C++ Files CMake doesnt know about...")
|
||||||
for cf in sorted(source_list(SOURCE_DIR, is_c)):
|
for cf in sorted(source_list(SOURCE_DIR, is_c)):
|
||||||
if not is_ignore(cf):
|
if not is_ignore(cf):
|
||||||
if cf not in global_c:
|
if cf not in global_c:
|
||||||
print("missing_c: ", cf)
|
print("missing_c: ", cf)
|
||||||
@@ -301,13 +302,13 @@ for cf in sorted(source_list(SOURCE_DIR, is_c)):
|
|||||||
print("bad_c: ", cf)
|
print("bad_c: ", cf)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
print("\nC/C++ Headers CMake doesnt know about...")
|
print("\nC/C++ Headers CMake doesnt know about...")
|
||||||
for hf in sorted(source_list(SOURCE_DIR, is_c_header)):
|
for hf in sorted(source_list(SOURCE_DIR, is_c_header)):
|
||||||
if not is_ignore(hf):
|
if not is_ignore(hf):
|
||||||
if hf not in global_h:
|
if hf not in global_h:
|
||||||
print("missing_h: ", hf)
|
print("missing_h: ", hf)
|
||||||
|
|
||||||
if UTF8_CHECK:
|
if UTF8_CHECK:
|
||||||
# test encoding
|
# test encoding
|
||||||
import traceback
|
import traceback
|
||||||
for files in (global_c, global_h):
|
for files in (global_c, global_h):
|
||||||
@@ -323,3 +324,6 @@ if UTF8_CHECK:
|
|||||||
print("Non utf8: %s:%d" % (f, i))
|
print("Non utf8: %s:%d" % (f, i))
|
||||||
if i > 1:
|
if i > 1:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
@@ -170,7 +170,7 @@ def write_png(buf, width, height):
|
|||||||
png_pack(b'IEND', b'')])
|
png_pack(b'IEND', b'')])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
def main():
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
@@ -186,3 +186,7 @@ if __name__ == '__main__':
|
|||||||
f = open(file_out, "wb")
|
f = open(file_out, "wb")
|
||||||
f.write(write_png(buf, width, height))
|
f.write(write_png(buf, width, height))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
@@ -696,7 +696,7 @@ def BuildRNAInfo():
|
|||||||
return InfoStructRNA.global_lookup, InfoFunctionRNA.global_lookup, InfoOperatorRNA.global_lookup, InfoPropertyRNA.global_lookup
|
return InfoStructRNA.global_lookup, InfoFunctionRNA.global_lookup, InfoOperatorRNA.global_lookup, InfoPropertyRNA.global_lookup
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
import rna_info
|
import rna_info
|
||||||
struct = rna_info.BuildRNAInfo()[0]
|
struct = rna_info.BuildRNAInfo()[0]
|
||||||
data = []
|
data = []
|
||||||
@@ -724,3 +724,7 @@ if __name__ == "__main__":
|
|||||||
else:
|
else:
|
||||||
text = bpy.data.texts.new(name="api.py")
|
text = bpy.data.texts.new(name="api.py")
|
||||||
text.from_string(data)
|
text.from_string(data)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
@@ -32,7 +32,7 @@ def build_property_typemap(skip_classes, skip_typemap):
|
|||||||
if issubclass(cls, skip_classes):
|
if issubclass(cls, skip_classes):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
## to support skip-save we cant get all props
|
# # to support skip-save we cant get all props
|
||||||
# properties = cls.bl_rna.properties.keys()
|
# properties = cls.bl_rna.properties.keys()
|
||||||
properties = []
|
properties = []
|
||||||
for prop_id, prop in cls.bl_rna.properties.items():
|
for prop_id, prop in cls.bl_rna.properties.items():
|
||||||
|
@@ -75,7 +75,6 @@ class MeshMirrorUV(Operator):
|
|||||||
double_warn += co in mirror_lt
|
double_warn += co in mirror_lt
|
||||||
mirror_lt[co] = i
|
mirror_lt[co] = i
|
||||||
|
|
||||||
#for i, v in enumerate(mesh.vertices):
|
|
||||||
vmap = {}
|
vmap = {}
|
||||||
for mirror_a, mirror_b in ((mirror_gt, mirror_lt),
|
for mirror_a, mirror_b in ((mirror_gt, mirror_lt),
|
||||||
(mirror_lt, mirror_gt)):
|
(mirror_lt, mirror_gt)):
|
||||||
|
@@ -163,7 +163,7 @@ if USE_ATTRSET:
|
|||||||
if issubclass(cls, skip_classes):
|
if issubclass(cls, skip_classes):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
## to support skip-save we cant get all props
|
# # to support skip-save we cant get all props
|
||||||
# properties = cls.bl_rna.properties.keys()
|
# properties = cls.bl_rna.properties.keys()
|
||||||
properties = []
|
properties = []
|
||||||
for prop_id, prop in cls.bl_rna.properties.items():
|
for prop_id, prop in cls.bl_rna.properties.items():
|
||||||
|
@@ -117,7 +117,18 @@ def main():
|
|||||||
|
|
||||||
# these are very picky and often hard to follow
|
# these are very picky and often hard to follow
|
||||||
# while keeping common script formatting.
|
# while keeping common script formatting.
|
||||||
ignore = "E122", "E123", "E124", "E125", "E126", "E127", "E128"
|
ignore = (
|
||||||
|
"E122",
|
||||||
|
"E123",
|
||||||
|
"E124",
|
||||||
|
"E125",
|
||||||
|
"E126",
|
||||||
|
"E127",
|
||||||
|
"E128",
|
||||||
|
# "imports not at top of file."
|
||||||
|
# prefer to load as needed (lazy load addons etc).
|
||||||
|
"E402",
|
||||||
|
)
|
||||||
|
|
||||||
for f, pep8_type in files:
|
for f, pep8_type in files:
|
||||||
|
|
||||||
|
@@ -28,7 +28,8 @@
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
Directive = collections.namedtuple('Directive',
|
Directive = collections.namedtuple(
|
||||||
|
"Directive",
|
||||||
("type",
|
("type",
|
||||||
"value",
|
"value",
|
||||||
"value_strip",
|
"value_strip",
|
||||||
@@ -80,7 +81,7 @@ def parse_rst_py(filepath):
|
|||||||
return tree[0]
|
return tree[0]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main():
|
||||||
# not intended use, but may as well print rst files passed as a test.
|
# not intended use, but may as well print rst files passed as a test.
|
||||||
import sys
|
import sys
|
||||||
for arg in sys.argv:
|
for arg in sys.argv:
|
||||||
@@ -88,3 +89,7 @@ if __name__ == "__main__":
|
|||||||
items = parse_rst_py(arg)
|
items = parse_rst_py(arg)
|
||||||
for i in items:
|
for i in items:
|
||||||
print(i)
|
print(i)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
Reference in New Issue
Block a user