pep8 checker, mostly pedantic style changes but also found an error in mesh_utils...
authorCampbell Barton <ideasman42@gmail.com>
Fri, 1 Apr 2011 02:41:15 +0000 (02:41 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 1 Apr 2011 02:41:15 +0000 (02:41 +0000)
17 files changed:
build_files/buildbot/master_unpack.py
build_files/buildbot/slave_pack.py
build_files/cmake/cmake_qtcreator_project.py
build_files/cmake/example_scripts/make_quicky.py
release/scripts/modules/addon_utils.py
release/scripts/modules/bpy/utils.py
release/scripts/modules/bpyml_ui.py
release/scripts/modules/mesh_utils.py
release/scripts/startup/bl_operators/object_quick_effects.py
release/scripts/startup/bl_operators/object_randomize_transform.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_animviz.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/templates/operator_modal_timer.py
source/tests/bl_run_operators.py

index f97e53384b0e613fcb9030dfaed2b37c26d55aeb..612b686b49aa4f9fb29fc2ab32aa1263edf514dc 100644 (file)
@@ -94,11 +94,11 @@ if platform == '':
     sys.exit(1)
 
 # extract
-dir = 'public_html/download'
+directory = 'public_html/download'
 
 try:
     zf = z.open(package)
-    f = file(os.path.join(dir, packagename), "wb")
+    f = file(os.path.join(directory, packagename), "wb")
 
     shutil.copyfileobj(zf, f)
 
@@ -112,10 +112,10 @@ except Exception, ex:
 
 # remove other files from the same platform
 try:
-    for f in os.listdir(dir):
+    for f in os.listdir(directory):
         if platform.lower() in f.lower():
             if f != packagename:
-                os.remove(os.path.join(dir, f))
+                os.remove(os.path.join(directory, f))
 except Exception, ex:
     sys.stderr.write('Failed to remove old packages: %s\n' % str(ex))
     sys.exit(1)
index 74d00bf9249235f1bb0df8f55a0b4444dc7d1977..effe7751915bec38727aa8087267eec7a6789c36 100644 (file)
@@ -41,12 +41,12 @@ if builder.find('scons') != -1:
     sys.exit(retcode)
 
 # clean release directory if it already exists
-dir = 'release'
+directory = 'release'
 
-if os.path.exists(dir):
-    for f in os.listdir(dir):
-        if os.path.isfile(os.path.join(dir, f)):
-            os.remove(os.path.join(dir, f))
+if os.path.exists(directory):
+    for f in os.listdir(directory):
+        if os.path.isfile(os.path.join(directory, f)):
+            os.remove(os.path.join(directory, f))
 
 # create release package
 try:
@@ -56,7 +56,7 @@ except Exception, ex:
     sys.exit(1)
 
 # find release directory, must exist this time
-if not os.path.exists(dir):
+if not os.path.exists(directory):
     sys.stderr.write("Failed to find release directory.\n")
     sys.exit(1)
 
@@ -64,8 +64,8 @@ if not os.path.exists(dir):
 file = None
 filepath = None
 
-for f in os.listdir(dir):
-    rf = os.path.join(dir, f)
+for f in os.listdir(directory):
+    rf = os.path.join(directory, f)
     if os.path.isfile(rf) and f.startswith('blender'):
         file = f
         filepath = rf
index 1bad1835434bd5ba0916efbc8528095697373a1c..601cf865ab44ba1ea4fd87dd6ec980fbb8e32abd 100644 (file)
@@ -114,7 +114,6 @@ def cmake_advanced_info():
     """
 
     def create_eclipse_project(CMAKE_DIR):
-        import sys
         if sys.platform == "win32":
             cmd = 'cmake %r -G"Eclipse CDT4 - MinGW Makefiles"' % CMAKE_DIR
         else:
@@ -125,7 +124,7 @@ def cmake_advanced_info():
     includes = []
     defines = []
 
-    import os
+
 
     create_eclipse_project(CMAKE_DIR)
 
index d7c43f4b86e27962780144c52f6cf5ad99b951bc..a4e0d3371f16e5de9cd417f4c17c4a82f950c781 100755 (executable)
@@ -43,8 +43,8 @@ def main():
     targets = set()
 
     # collect targets
-    file = open("Makefile", "r")
-    for line in file:
+    makefile = open("Makefile", "r")
+    for line in makefile:
         line = line.rstrip()
         if not line or line[0] in ". \t@$#":
             continue
@@ -59,7 +59,7 @@ def main():
             continue
 
         targets.add(line)
-    file.close()
+    makefile.close()
 
     # remove cmake targets
     bad = set([
index 62a9f691acff647b1aa8cb5aa7591ca23075b356..3877f711b7fbc60b395cfbc6536fc7bf4f4a633f 100644 (file)
@@ -107,7 +107,7 @@ def modules(module_cache):
                 import traceback
                 traceback.print_exc()
                 raise
-            
+
             return mod
         else:
             return None
@@ -246,7 +246,6 @@ def disable(module_name, default_set=True):
     :type module_name: string
     """
     import sys
-    import traceback
     import bpy_types as _bpy_types
 
     mod = sys.modules.get(module_name)
@@ -259,6 +258,7 @@ def disable(module_name, default_set=True):
         try:
             mod.unregister()
         except:
+            import traceback
             traceback.print_exc()
     else:
         print("addon_utils.disable", module_name, "not loaded")
index cb2349eab1ded6dcb08d466e0f0403f6a4e2454a..b7c52a35fdf6a038fc3fb0928f9a0c07280e1f3c 100644 (file)
@@ -347,7 +347,6 @@ def keyconfig_set(filepath):
 
     print("loading preset:", filepath)
     keyconfigs = _bpy.context.window_manager.keyconfigs
-    kc_orig = keyconfigs.active
 
     keyconfigs_old = keyconfigs[:]
 
index 2462dd60e3e20e70e483458bb00651fe5d826ecf..1e0522974d19659318ff872ad834169905bc19d5 100644 (file)
@@ -65,7 +65,7 @@ def _parse_rna_args(base, py_node):
 
 
 def _call_recursive(context, base, py_node):
-    prop = base.bl_rna.properties.get(py_node[TAG])
+    prop = base.bl_rna.properties.get(py_node[TAG])
     if py_node[TAG] in base.bl_rna.properties:
         value = py_node[ARGS].get("expr")
         if value:
@@ -73,7 +73,7 @@ def _call_recursive(context, base, py_node):
             setattr(base, py_node[TAG], value)
         else:
             value = py_node[ARGS]['value']  # have to have this
-            setattr(base, name, value)
+            setattr(base, py_node[TAG], value)
     else:
         args = _parse_rna_args(base, py_node)
         func_new = getattr(base, py_node[TAG])
index f65aa8b306f9080525e1e9248e0cfeb2cb3d41da..5bacff7b0ccdfef1d845408754eb4d6ddc9dc1ee 100644 (file)
@@ -19,7 +19,7 @@
 # <pep8 compliant>
 
 
-def mesh_linked_faces(me):
+def mesh_linked_faces(mesh):
     '''
     Splits the mesh into connected parts,
     these parts are returned as lists of faces.
index 73119a6e2160ca4ce2eabc321a72da7c66084cad..b50bb2dc3cc643f70080fee128aca9ed91c4a489 100644 (file)
@@ -18,7 +18,6 @@
 
 # <pep8 compliant>
 
-import mathutils
 from mathutils import Vector
 import bpy
 from bpy.props import BoolProperty, EnumProperty, IntProperty, FloatProperty, FloatVectorProperty
@@ -80,6 +79,7 @@ class MakeFur(bpy.types.Operator):
 
         return {'FINISHED'}
 
+
 def obj_bb_minmax(obj, min_co, max_co):
     for i in range(0, 8):
         bb_vec = Vector((obj.bound_box[i][0], obj.bound_box[i][1], obj.bound_box[i][2])) * obj.matrix_world
@@ -91,6 +91,7 @@ def obj_bb_minmax(obj, min_co, max_co):
         max_co[1] = max(bb_vec[1], max_co[1])
         max_co[2] = max(bb_vec[2], max_co[2])
 
+
 class MakeSmoke(bpy.types.Operator):
     bl_idname = "object.make_smoke"
     bl_label = "Make Smoke"
@@ -148,8 +149,8 @@ class MakeSmoke(bpy.types.Operator):
         obj.name = "Smoke Domain"
 
         # give the smoke some room above the flows
-        obj.location = 0.5 * (max_co + min_co) + Vector((0,0,1))
-        obj.scale = 0.5 * (max_co - min_co) + Vector((1,1,2))
+        obj.location = 0.5 * (max_co + min_co) + Vector((0.0, 0.0, 1.0))
+        obj.scale = 0.5 * (max_co - min_co) + Vector((1.0, 1.0, 2.0))
 
         # setup smoke domain
         bpy.ops.object.modifier_add({"object": obj}, type='SMOKE')
@@ -261,8 +262,8 @@ class MakeFluid(bpy.types.Operator):
 
         # give the fluid some room below the flows and scale with initial velocity
         v = 0.5 * self.initial_velocity
-        obj.location = 0.5 * (max_co + min_co) + Vector((0,0,-1)) + v
-        obj.scale = 0.5 * (max_co - min_co) + Vector((1,1,2)) + Vector((abs(v[0]), abs(v[1]), abs(v[2])))
+        obj.location = 0.5 * (max_co + min_co) + Vector((0.0, 0.0, -1.0)) + v
+        obj.scale = 0.5 * (max_co - min_co) + Vector((1.0, 1.0, 2.0)) + Vector((abs(v[0]), abs(v[1]), abs(v[2])))
 
         # setup smoke domain
         bpy.ops.object.modifier_add({"object": obj}, type='FLUID_SIMULATION')
@@ -279,7 +280,7 @@ class MakeFluid(bpy.types.Operator):
         mat.specular_intensity = 1
         mat.specular_hardness = 100
         mat.use_transparency = True
-        mat.alpha = 0
+        mat.alpha = 0.0
         mat.transparency_method = 'RAYTRACE'
         mat.raytrace_transparency.ior = 1.33
         mat.raytrace_transparency.depth = 4
index d72c600ef784ac5bbb781cbabe639bce04a16a3c..9dc5086086f479b0d70c50ce961c928bb05b747a 100644 (file)
@@ -84,7 +84,7 @@ def randomize_selected(seed, delta, loc, rot, scale, scale_even):
             uniform(0.0, 0.0), uniform(0.0, 0.0), uniform(0.0, 0.0)
 
 
-from bpy.props import IntProperty, BoolProperty, FloatProperty, FloatVectorProperty
+from bpy.props import IntProperty, BoolProperty, FloatVectorProperty
 
 
 class RandomizeLocRotSize(bpy.types.Operator):
index e6f71ef9573506d24042fc031c397e31f5769917..1cef67dc710a9a3436c020ed06a8cb13590f213b 100644 (file)
@@ -19,7 +19,6 @@
 # <pep8 compliant>
 
 import bpy
-import os
 
 
 class AddPresetBase():
index 6ed461910990736f99bba0b7452f57af50f89aa9..a77ff0ce5e3062b75034f5d0f5730e74c6dd69aa 100644 (file)
@@ -859,6 +859,7 @@ class WM_OT_keyconfig_activate(bpy.types.Operator):
         bpy.utils.keyconfig_set(self.filepath)
         return {'FINISHED'}
 
+
 class WM_OT_appconfig_default(bpy.types.Operator):
     bl_idname = "wm.appconfig_default"
     bl_label = "Default Application Configuration"
@@ -868,13 +869,14 @@ class WM_OT_appconfig_default(bpy.types.Operator):
 
         context.window_manager.keyconfigs.active = context.window_manager.keyconfigs.default
 
-        filepath = os.path.join(bpy.utils.preset_paths("interaction")[0], "blender.py")        
-        
+        filepath = os.path.join(bpy.utils.preset_paths("interaction")[0], "blender.py")
+
         if os.path.exists(filepath):
-            bpy.ops.script.execute_preset(filepath = filepath, menu_idname = "USERPREF_MT_interaction_presets")
-        
+            bpy.ops.script.execute_preset(filepath=filepath, menu_idname="USERPREF_MT_interaction_presets")
+
         return {'FINISHED'}
 
+
 class WM_OT_appconfig_activate(bpy.types.Operator):
     bl_idname = "wm.appconfig_activate"
     bl_label = "Activate Application Configuration"
@@ -884,14 +886,15 @@ class WM_OT_appconfig_activate(bpy.types.Operator):
     def execute(self, context):
         import os
         bpy.utils.keyconfig_set(self.filepath)
-        
+
         filepath = self.filepath.replace("keyconfig", "interaction")
-        
+
         if os.path.exists(filepath):
-            bpy.ops.script.execute_preset(filepath = filepath, menu_idname = "USERPREF_MT_interaction_presets")
-        
+            bpy.ops.script.execute_preset(filepath=filepath, menu_idname="USERPREF_MT_interaction_presets")
+
         return {'FINISHED'}
 
+
 class WM_OT_sysinfo(bpy.types.Operator):
     '''Generate System Info'''
     bl_idname = "wm.sysinfo"
index ac25c643cab3bb7fe91ae77d599b1950b4c4b427..cebe58291d8e2c829a53927809df19dbefac05a2 100644 (file)
@@ -17,8 +17,6 @@
 # ##### END GPL LICENSE BLOCK #####
 
 # <pep8 compliant>
-import bpy
-
 
 # Generic Panels (Independent of DataType)
 
index 09915b03926f644658185051a46e2e1828e35440..014aead3c08dcbfde898a98fdc6ce6ec5840a0b3 100644 (file)
@@ -889,7 +889,7 @@ class PARTICLE_PT_render(ParticleButtonsPanel, bpy.types.Panel):
             split = layout.split(percentage=0.33)
             split.label(text="Split uv's:")
             split.prop(part, "billboard_uv_split", text="Number of splits")
-            
+
             if psys:
                 col = layout.column()
                 col.active = part.billboard_uv_split > 1
index 69fe7c3d948e451aaae4379df5fd5bc09d005757..a81561de93fabb4bb20ebd3945d1fadd61281f3f 100644 (file)
@@ -21,7 +21,7 @@ import bpy
 import os
 import addon_utils
 
-from bpy.props import StringProperty, BoolProperty, EnumProperty
+from bpy.props import StringProperty, BoolProperty
 
 
 def ui_items_general(col, context):
@@ -119,6 +119,7 @@ class USERPREF_MT_interaction_presets(bpy.types.Menu):
     preset_operator = "script.execute_preset"
     draw = bpy.types.Menu.draw_preset
 
+
 class USERPREF_MT_appconfigs(bpy.types.Menu):
     bl_label = "AppPresets"
     preset_subdir = "keyconfig"
@@ -130,6 +131,7 @@ class USERPREF_MT_appconfigs(bpy.types.Menu):
         # now draw the presets
         bpy.types.Menu.draw_preset(self, context)
 
+
 class USERPREF_MT_splash(bpy.types.Menu):
     bl_label = "Splash"
 
index d8c218f67ea461c8451abad357f922ab18c757a6..d2267191cf54f7fa8eea1544d95b5ebab16b85b9 100644 (file)
@@ -1,5 +1,4 @@
 import bpy
-from bpy.props import IntProperty, FloatProperty
 
 
 class ModalTimerOperator(bpy.types.Operator):
index f1f21d3bd71b7bbd698b88e0036a756e84202575..668b4e692284242f0681f30ef5d8de21606b0b12 100644 (file)
@@ -113,11 +113,6 @@ def ctx_editmode_mball():
     bpy.ops.object.mode_set(mode='EDIT')
 
 
-def ctx_editmode_mball():
-    bpy.ops.object.metaball_add()
-    bpy.ops.object.mode_set(mode='EDIT')
-
-
 def ctx_editmode_text():
     bpy.ops.object.text_add()
     bpy.ops.object.mode_set(mode='EDIT')