[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34636] trunk/blender: pep8 cleanup

Campbell Barton ideasman42 at gmail.com
Fri Feb 4 10:27:26 CET 2011


Revision: 34636
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34636
Author:   campbellbarton
Date:     2011-02-04 09:27:25 +0000 (Fri, 04 Feb 2011)
Log Message:
-----------
pep8 cleanup

Modified Paths:
--------------
    trunk/blender/build_files/cmake/cmake_consistency_check.py
    trunk/blender/build_files/cmake/cmake_qtcreator_project.py
    trunk/blender/doc/python_api/sphinx_doc_gen.py
    trunk/blender/release/bin/blender-thumbnailer.py
    trunk/blender/release/scripts/keyingsets/keyingsets_builtins.py
    trunk/blender/release/scripts/keyingsets/keyingsets_utils.py
    trunk/blender/release/scripts/op/fcurve_euler_filter.py
    trunk/blender/release/scripts/presets/ffmpeg/DVD.py
    trunk/blender/release/scripts/presets/ffmpeg/SVCD.py
    trunk/blender/release/scripts/presets/ffmpeg/VCD.py
    trunk/blender/release/scripts/presets/ffmpeg/h264.py
    trunk/blender/release/scripts/presets/ffmpeg/theora.py
    trunk/blender/release/scripts/presets/ffmpeg/xvid.py
    trunk/blender/release/scripts/presets/sss/apple.py
    trunk/blender/release/scripts/ui/properties_physics_common.py
    trunk/blender/release/scripts/ui/properties_physics_field.py
    trunk/blender/release/scripts/ui/properties_render.py
    trunk/blender/release/scripts/ui/space_dopesheet.py
    trunk/blender/release/scripts/ui/space_node.py
    trunk/blender/release/scripts/ui/space_view3d_toolbar.py
    trunk/blender/source/tests/pep8.py

Modified: trunk/blender/build_files/cmake/cmake_consistency_check.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_consistency_check.py	2011-02-04 09:02:47 UTC (rev 34635)
+++ trunk/blender/build_files/cmake/cmake_consistency_check.py	2011-02-04 09:27:25 UTC (rev 34636)
@@ -21,6 +21,8 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
+# <pep8 compliant>
+
 IGNORE = \
     "/test/",\
     "/decimate_glut_test/",\
@@ -45,6 +47,8 @@
 
 import os
 from os.path import  splitext
+
+
 def source_list(path, filename_check=None):
     for dirpath, dirnames, filenames in os.walk(path):
 
@@ -56,31 +60,37 @@
             if filename_check is None or filename_check(filename):
                 yield os.path.join(dirpath, filename)
 
+
 # extension checking
 def is_c_header(filename):
     ext = splitext(filename)[1]
     return (ext in (".h", ".hpp", ".hxx"))
 
+
 def is_cmake(filename):
     ext = splitext(filename)[1]
     return (ext == ".cmake") or (filename == "CMakeLists.txt")
 
+
 def is_c_header(filename):
     ext = splitext(filename)[1]
     return (ext in (".h", ".hpp", ".hxx"))
 
+
 def is_c(filename):
     ext = splitext(filename)[1]
     return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
 
+
 def is_c_any(filename):
     return is_c(filename) or is_c_header(filename)
 
+
 def cmake_get_src(f):
-    
+
     sources_h = []
     sources_c = []
-    
+
     filen = open(f, "r", encoding="utf8")
     it = iter(filen)
     found = False
@@ -101,7 +111,7 @@
                         raise Exception("strict formatting not kept 'set(SRC*' %s:%d" % (f, i))
                     found = True
                     break
-                
+
                 if "list(APPEND SRC" in l:
                     if l.endswith(")"):
                         raise Exception("strict formatting not kept 'list(APPEND SRC...)' on 1 line %s:%d" % (f, i))
@@ -118,11 +128,11 @@
                 except StopIteration:
                     it = None
                     break
-                    
+
                 l = l.strip()
 
                 if not l.startswith("#"):
-                        
+
                     if ")" in l:
                         if l.strip() != ")":
                             raise Exception("strict formatting not kept '*)' %s:%d" % (f, i))
@@ -130,7 +140,6 @@
 
                     # replace dirs
                     l = l.replace("${CMAKE_CURRENT_SOURCE_DIR}", cmake_base)
-                    
 
                     if not l:
                         pass
@@ -140,7 +149,7 @@
                         raise Exception("Multi-line define '%s' %s:%d" % (l, f, i))
                     else:
                         new_file = normpath(join(cmake_base, l))
-                        
+
                         if is_c_header(new_file):
                             sources_h.append(new_file)
                         elif is_c(new_file):
@@ -168,19 +177,20 @@
                 if ff not in sources_c:
                     print("  missing: " + ff)
             '''
-    
+
     filen.close()
 
 
 for cmake in source_list(base, is_cmake):
     cmake_get_src(cmake)
 
+
 def is_ignore(f):
     for ig in IGNORE:
         if ig in f:
             return True
     return False
-    
+
 # First do stupid check, do these files exist?
 for f in (global_h | global_c):
     if f.endswith("dna.c"):
@@ -189,7 +199,7 @@
     if not os.path.exists(f):
         raise Exception("CMake referenced file missing: " + f)
 
-    
+
 # now check on files not accounted for.
 print("\nC/C++ Files CMake doesnt know about...")
 for cf in sorted(source_list(base, is_c)):

Modified: trunk/blender/build_files/cmake/cmake_qtcreator_project.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_qtcreator_project.py	2011-02-04 09:02:47 UTC (rev 34635)
+++ trunk/blender/build_files/cmake/cmake_qtcreator_project.py	2011-02-04 09:27:25 UTC (rev 34636)
@@ -21,6 +21,8 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
+# <pep8 compliant>
+
 import os
 from os.path import join, dirname, normpath, abspath, splitext, relpath, exists
 
@@ -28,6 +30,7 @@
 base = normpath(base)
 base = abspath(base)
 
+
 def source_list(path, filename_check=None):
     for dirpath, dirnames, filenames in os.walk(path):
 
@@ -40,33 +43,40 @@
             if filename_check is None or filename_check(filepath):
                 yield filepath
 
+
 # extension checking
 def is_c_header(filename):
     ext = splitext(filename)[1]
     return (ext in (".h", ".hpp", ".hxx"))
 
+
 def is_cmake(filename):
     ext = splitext(filename)[1]
     return (ext == ".cmake") or (filename == "CMakeLists.txt")
 
+
 def is_c_header(filename):
     ext = splitext(filename)[1]
     return (ext in (".h", ".hpp", ".hxx"))
 
+
 def is_c(filename):
     ext = splitext(filename)[1]
     return (ext in (".c", ".cpp", ".cxx", ".m", ".mm", ".rc"))
 
+
 def is_c_any(filename):
     return is_c(filename) or is_c_header(filename)
 
+
 def is_svn_file(filename):
-	dn, fn = os.path.split(filename)
-	filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn)
-	return exists(filename_svn)
+    dn, fn = os.path.split(filename)
+    filename_svn = join(dn, ".svn", "text-base", "%s.svn-base" % fn)
+    return exists(filename_svn)
 
+
 def is_project_file(filename):
-	return (is_c_any(filename) or is_cmake(filename)) and is_svn_file(filename)
+    return (is_c_any(filename) or is_cmake(filename)) and is_svn_file(filename)
 
 files = list(source_list(base, filename_check=is_project_file))
 files_rel = [relpath(f, start=base) for f in files]
@@ -87,8 +97,8 @@
 
 qtc_cfg = join(base, "%s.config" % PROJECT_NAME)
 if not exists(qtc_cfg):
-	f = open(qtc_cfg, 'w')
-	f.write("// ADD PREDEFINED MACROS HERE!\n")
+    f = open(qtc_cfg, 'w')
+    f.write("// ADD PREDEFINED MACROS HERE!\n")
 
 print("Project file written to: %s" % qtc_prj)
 # --- end

Modified: trunk/blender/doc/python_api/sphinx_doc_gen.py
===================================================================
--- trunk/blender/doc/python_api/sphinx_doc_gen.py	2011-02-04 09:02:47 UTC (rev 34635)
+++ trunk/blender/doc/python_api/sphinx_doc_gen.py	2011-02-04 09:27:25 UTC (rev 34636)
@@ -18,6 +18,8 @@
  #
  # #**** END GPL LICENSE BLOCK #****
 
+# <pep8 compliant>
+
 script_help_msg = '''
 Usage:
 
@@ -31,11 +33,11 @@
   assuming that ./blender.bin is or links to the blender executable
 
 - Generate html docs by running...
-    
+
     sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out
 
   assuming that you have sphinx 0.6.7 installed
-  
+
 For PDF generation
 ------------------
 - After you have built doc/python_api/sphinx-in (see above), run:
@@ -81,10 +83,12 @@
     Converts values to strings for the range directive.
     (unused function it seems)
     '''
-    if val < -10000000:	return '-inf'
-    if val >  10000000:	return 'inf'
-    if type(val)==float:
-        return '%g'  % val
+    if val < -10000000:
+        return '-inf'
+    elif val > 10000000:
+        return 'inf'
+    elif type(val) == float:
+        return '%g' % val
     else:
         return str(val)
 
@@ -139,7 +143,7 @@
 
     if not is_class:
         func_type = "function"
-        
+
         # ther rest are class methods
     elif arg_str.startswith("(self, "):
         arg_str = "(" + arg_str[7:]
@@ -156,14 +160,14 @@
         fw("\n")
 
 
-def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):    
+def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
     if identifier.startswith("_"):
         return
-    
+
     doc = descr.__doc__
     if not doc:
         doc = undocumented_message(module_name, type_name, identifier)
-    
+
     if type(descr) == GetSetDescriptorType:
         fw(ident + ".. attribute:: %s\n\n" % identifier)
         write_indented_lines(ident + "   ", fw, doc, False)
@@ -180,7 +184,7 @@
     '''
     c defined function to sphinx.
     '''
-    
+
     # dump the docstring, assume its formatted correctly
     if py_func.__doc__:
         write_indented_lines(ident, fw, py_func.__doc__, False)
@@ -208,30 +212,30 @@
     import types
     attribute_set = set()
     filepath = os.path.join(BASEPATH, module_name + ".rst")
-    
+
     file = open(filepath, "w")
 
     fw = file.write
-    
+
     fw(title + "\n")
     fw(("=" * len(title)) + "\n\n")
-    
+
     fw(".. module:: %s\n\n" % module_name)
-    
+
     if module.__doc__:
         # Note, may contain sphinx syntax, dont mangle!
         fw(module.__doc__.strip())
         fw("\n\n")
-        
+
     write_example_ref("", fw, module_name)
-    
+
     # write members of the module
     # only tested with PyStructs which are not exactly modules
     for key, descr in sorted(type(module).__dict__.items()):
         if key.startswith("__"):
             continue
         # naughty, we also add getset's into PyStructs, this is not typical py but also not incorrect.
-        if type(descr) == types.GetSetDescriptorType: # 'bpy_app_type' name is only used for examples and messages
+        if type(descr) == types.GetSetDescriptorType:  # 'bpy_app_type' name is only used for examples and messages
             py_descr2sphinx("", fw, descr, module_name, "bpy_app_type", key)
             attribute_set.add(key)
     for key, descr in sorted(type(module).__dict__.items()):
@@ -245,7 +249,7 @@
                 attribute_set.add(key)
                 fw("\n")
     del key, descr
-    
+
     classes = []
 
     for attribute in sorted(dir(module)):
@@ -254,16 +258,16 @@
             if attribute in attribute_set:
                 continue
 
-            if attribute.startswith("n_"): # annoying exception, needed for bpy.app
+            if attribute.startswith("n_"):  # annoying exception, needed for bpy.app
                 continue
-            
+
             value = getattr(module, attribute)
 
             value_type = type(value)
 
             if value_type == types.FunctionType:
                 pyfunc2sphinx("", fw, attribute, value, is_class=False)
-            elif value_type in (types.BuiltinMethodType, types.BuiltinFunctionType): # both the same at the moment but to be future proof
+            elif value_type in (types.BuiltinMethodType, types.BuiltinFunctionType):  # both the same at the moment but to be future proof
                 # note: can't get args from these, so dump the string as is
                 # this means any module used like this must have fully formatted docstrings.

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list