pep8 cleanup and remove unused vars/imports
authorCampbell Barton <ideasman42@gmail.com>
Thu, 17 Feb 2011 04:35:41 +0000 (04:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 17 Feb 2011 04:35:41 +0000 (04:35 +0000)
20 files changed:
build_files/cmake/cmake_consistency_check.py
build_files/cmake/cmake_qtcreator_project.py
release/datafiles/ctodata.py
release/scripts/modules/bpy/utils.py
release/scripts/modules/sys_info.py
release/scripts/op/object.py
release/scripts/ui/properties_data_armature.py
release/scripts/ui/properties_data_mesh.py
release/scripts/ui/properties_material.py
release/scripts/ui/properties_object.py
release/scripts/ui/properties_particle.py
release/scripts/ui/properties_render.py
release/scripts/ui/space_console.py
release/scripts/ui/space_info.py
release/scripts/ui/space_logic.py
release/scripts/ui/space_sequencer.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_userpref_keymap.py
release/scripts/ui/space_view3d.py
release/scripts/ui/space_view3d_toolbar.py

index ec82d1b3b2312d930c65d8d0f7b5b128a9154557..f55b2e95d5e36c02e9fd96b44f2bba337d543a3c 100644 (file)
@@ -34,7 +34,7 @@ IGNORE = \
     "/ik_glut_test/"
 
 import os
-from os.path import join, dirname, normpath, abspath
+from os.path import join, dirname, normpath, abspath, splitext
 
 base = join(os.path.dirname(__file__), "..", "..")
 base = normpath(base)
@@ -45,9 +45,6 @@ print("Scanning:", base)
 global_h = set()
 global_c = set()
 
-import os
-from os.path import  splitext
-
 
 def source_list(path, filename_check=None):
     for dirpath, dirnames, filenames in os.walk(path):
index 3adce66fadefa3672c761093e7c70ffd85a82d00..ca214338298edc4b1a32858c2e894a4ca3437090 100644 (file)
@@ -45,11 +45,6 @@ def source_list(path, filename_check=None):
 
 
 # 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")
index be33f724deb0b2531af74bf9df11964ba1ce3bb7..2d2daabb661cfac310c3796e0fbb0ee2faabdfba 100644 (file)
@@ -28,7 +28,6 @@
 # <pep8 compliant>
 
 import sys
-import os
 
 if len(sys.argv) < 2:
     sys.stdout.write("Usage: ctodata <c_file>\n")
index 56f365db7d8f1afdc25eeb7c0c0f3311a95ece70..6baed344f759151922eca8310482240c1b22c37d 100644 (file)
@@ -74,9 +74,6 @@ def modules_from_path(path, loaded_modules):
     :return: all loaded modules.
     :rtype: list
     """
-    import traceback
-    import time
-
     modules = []
 
     for mod_name, mod_path in _bpy.path.module_names(path):
index 303277a5d75fd5a13e5c7889c50aa3fb7ceb2ec0..16dfbf1bb3d68c830ae2a6361fd9700bf64af018 100644 (file)
@@ -50,8 +50,6 @@ def textWrap(text, length=70):
 
 def write_sysinfo(op):
     output_filename = "system-info.txt"
-    warnings = 0
-    notices = 0
 
     if output_filename in bpy.data.texts.keys():
         output = bpy.data.texts[output_filename]
index 928866899721fdfa05206dd74d567f82eed00c8a..81ddd4f7c35b1d1b99ed01de56d648c3593fd5a9 100644 (file)
@@ -476,7 +476,6 @@ class MakeDupliFace(bpy.types.Operator):
 
     def _main(self, context):
         from mathutils import Vector
-        from math import sqrt
 
         SCALE_FAC = 0.01
         offset = 0.5 * SCALE_FAC
index a1680daffe43e243e89ddd1d7f24df8613a1d6c2..5f5b5ad3878ca85cb8a3bd0915f1b3feb0159dcf 100644 (file)
@@ -157,42 +157,42 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel):
 class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel):
     bl_label = "Pose Library"
     bl_options = {'DEFAULT_CLOSED'}
-    
+
     @classmethod
     def poll(cls, context):
         return (context.object and context.object.type == 'ARMATURE' and context.object.pose)
-        
+
     def draw(self, context):
         layout = self.layout
-        
+
         ob = context.object
         poselib = ob.pose_library
-        
+
         row = layout.row()
         row.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink")
-        
+
         if poselib:
             activePoseIndex = poselib.pose_markers.active_index
             if poselib.pose_markers.active:
                 activePoseName = poselib.pose_markers.active.name
             else:
                 activePoseName = ""
-            
+
             row = layout.row()
             row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5)
-            
+
             col = row.column(align=True)
             col.active = (poselib.library is None)
-            
-            # invoke should still be used for 'add', as it is needed to allow 
+
+            # invoke should still be used for 'add', as it is needed to allow
             # add/replace options to be used properly
             col.operator("poselib.pose_add", icon='ZOOMIN', text="")
-            
-            col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so that menu doesn't need showing
+
+            col.operator_context = 'EXEC_DEFAULT'  # exec not invoke, so that menu doesn't need showing
             col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = activePoseName
 
             col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = activePoseIndex
-            
+
             row = layout.row()
             row.operator("poselib.action_sanitise")
 
index 342204d0e7867d0da3e65669e4a40e5f9e8a4a90..5c160a577e4a0cb2a740b1ac085b89bdc989d206 100644 (file)
@@ -283,7 +283,6 @@ class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
     @classmethod
     def poll(cls, context):
         ob = context.active_object
-        rd = context.scene.render
 
         return (context.mode == 'EDIT_MESH') and ob and ob.type == 'MESH'
 
index 17501475e51a08c195a9035636e12b40aa825a69..a531f1c545309be82f5669dd23ba1209c4c87d1d 100644 (file)
@@ -126,7 +126,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel):
         elif mat:
             split.template_ID(space, "pin_id")
             split.separator()
-        
+
         if mat:
             layout.prop(mat, "type", expand=True)
             if mat.use_nodes:
@@ -150,46 +150,46 @@ class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Render Pipeline Options"
     bl_options = {'DEFAULT_CLOSED'}
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
-    
+
     @classmethod
     def poll(cls, context):
         mat = context.material
         engine = context.scene.render.engine
         return mat and (mat.type in ('SURFACE', 'WIRE', 'VOLUME')) and (engine in cls.COMPAT_ENGINES)
-    
+
     def draw(self, context):
         layout = self. layout
-        
+
         mat = context.material
         #split = layout.split()
-        mat_type =  mat.type in ('SURFACE', 'WIRE')
-        
+        mat_type = mat.type in ('SURFACE', 'WIRE')
+
         row = layout.row()
         row.active = mat_type
         row.prop(mat, "use_transparency")
         sub = row.column()
         sub.prop(mat, "offset_z")
         sub.active = mat_type and mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY'
-        
+
         row = layout.row()
         row.active = mat.use_transparency or not mat_type
         row.prop(mat, "transparency_method", expand=True)
-        
-        layout.separator() 
-        
+
+        layout.separator()
+
         split = layout.split()
         col = split.column()
-        
-        col.prop(mat, "use_raytrace") # 
-        col.prop(mat, "use_full_oversampling") # 
+
+        col.prop(mat, "use_raytrace")
+        col.prop(mat, "use_full_oversampling")
         sub = col.column()
         sub.active = mat_type
         sub.prop(mat, "use_sky")
         sub.prop(mat, "invert_z")
-        
+
         col = split.column()
         col.active = mat_type
-        
+
         col.prop(mat, "use_cast_shadows_only", text="Cast Only")
         col.prop(mat, "shadow_cast_alpha", text="Casting Alpha")
         col.prop(mat, "use_cast_buffer_shadows")
@@ -205,7 +205,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel):
         mat = context.material
         engine = context.scene.render.engine
         return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-    
+
     def draw(self, context):
         layout = self.layout
 
@@ -264,7 +264,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel):
         mat = context.material
         engine = context.scene.render.engine
         return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-    
+
     def draw(self, context):
         layout = self.layout
 
@@ -321,7 +321,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
         mat = context.material
         engine = context.scene.render.engine
         return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-    
+
     def draw(self, context):
         layout = self.layout
 
@@ -359,17 +359,17 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
 
     def draw(self, context):
         layout = self.layout
-        
+
         base_mat = context.material
         mat = active_node_mat(context.material)
         rayt = mat.raytrace_transparency
-        
+
         split = layout.split()
 
         col = split.column()
         col.prop(mat, "alpha")
         row = col.row()
-        row.active = base_mat.use_transparency and (not mat.use_shadeless) # 
+        row.active = base_mat.use_transparency and (not mat.use_shadeless)
         row.prop(mat, "specular_alpha", text="Specular")
 
         col = split.column()
@@ -413,7 +413,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel):
 
     def draw_header(self, context):
         raym = active_node_mat(context.material).raytrace_mirror
-        
+
         self.layout.prop(raym, "use", text="")
 
     def draw(self, context):
@@ -679,7 +679,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel):
         mat = context.material
         engine = context.scene.render.engine
         return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-    
+
     def draw(self, context):
         layout = self.layout
 
@@ -717,7 +717,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel):
         mat = context.material
         engine = context.scene.render.engine
         return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
-    
+
     def draw(self, context):
         layout = self.layout
 
@@ -874,13 +874,13 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
     bl_label = "Options"
     COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
     bl_options = {'DEFAULT_CLOSED'}
-    
+
     @classmethod
     def poll(cls, context):
         mat = context.material
         engine = context.scene.render.engine
         return check_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES)
-    
+
     def draw(self, context):
         layout = self.layout
 
index 30380e2d3387f5b1db68b67445bbb8fe6c42bd2d..46455888e7b62e73812af9968a5cb53c5476c007 100644 (file)
@@ -329,8 +329,6 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel):  # , bpy.types.Panel): #
         return (context.object)
 
     def draw(self, context):
-        layout = self.layout
-
         ob = context.object
 
         self.draw_settings(context, ob.animation_visualisation)
index 6b635ce1ce863a775bf3f10ed3d632abfc0c81d8..f84b052df73862f8857733dcb93d9145e4e33d8f 100644 (file)
@@ -40,17 +40,18 @@ def particle_panel_poll(cls, context):
     psys = context.particle_system
     engine = context.scene.render.engine
     settings = 0
-    
+
     if psys:
         settings = psys.settings
     elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings):
         settings = context.space_data.pin_id
-    
+
     if not settings:
         return False
 
     return settings.is_fluid == False and (engine in cls.COMPAT_ENGINES)
-    
+
+
 def particle_get_settings(context):
     if context.particle_system:
         return context.particle_system.settings
@@ -97,18 +98,18 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
 
         if psys == None:
             part = particle_get_settings(context)
-            
+
             if part == None:
                 return
-                
+
             layout.template_ID(context.space_data, "pin_id")
-            
+
             if part.is_fluid:
                 layout.label(text="Settings used for fluid.")
                 return
-                
+
             layout.prop(part, "type", text="Type")
-        
+
         elif not psys.settings:
             split = layout.split(percentage=0.32)
 
@@ -392,7 +393,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
         if particle_panel_poll(PARTICLE_PT_rotation, context):
             psys = context.particle_system
             settings = particle_get_settings(context)
-            
+
             if settings.type == 'HAIR' and not settings.use_advanced_hair:
                 return False
             return settings.physics_type != 'BOIDS' and (psys == None or not psys.point_cache.use_external)
index 9c5fbb761663f9b8a06a0d43fb6ba2daaa4ad4f8..4916ba226c330aaf7c15337b15848c1325df060e 100644 (file)
@@ -304,18 +304,17 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel):
 
         if file_format == 'PNG':
             layout.prop(rd, "file_quality", slider=True, text="Compression")
-            
+
         if file_format in ('OPEN_EXR', 'MULTILAYER'):
             row = layout.row()
             row.prop(rd, "exr_codec", text="Codec")
-            
+
             if file_format == 'OPEN_EXR':
                 row = layout.row()
                 row.prop(rd, "use_exr_half")
                 row.prop(rd, "exr_zbuf")
                 row.prop(rd, "exr_preview")
 
-
         elif file_format == 'JPEG2000':
             split = layout.split()
             col = split.column()
@@ -418,7 +417,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel):
         col.label(text="Mux:")
         col.prop(rd, "ffmpeg_muxrate", text="Rate")
         col.prop(rd, "ffmpeg_packetsize", text="Packet Size")
-        
+
         layout.separator()
 
         # Audio:
index b3bd886d8c5b50d152942621bac5cade16180c0f..97720947e37c44f0ebe08a7a9747b97fda64d544 100644 (file)
@@ -25,7 +25,7 @@ class CONSOLE_HT_header(bpy.types.Header):
     bl_space_type = 'CONSOLE'
 
     def draw(self, context):
-        sc = context.space_data
+        sc = context.space_data
         # text = sc.text
         layout = self.layout
 
index 6c392cb9a3dc593e0c983fd608f8620f25dbe2b9..c19321a198bc2beb6f0101d29fb22f831ea77bdf 100644 (file)
@@ -26,9 +26,7 @@ class INFO_HT_header(bpy.types.Header):
     def draw(self, context):
         layout = self.layout
 
-        wm = context.window_manager
         window = context.window
-        sinfo = context.space_data
         scene = context.scene
         rd = scene.render
 
@@ -70,6 +68,7 @@ class INFO_HT_header(bpy.types.Header):
 
         # XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!!
         """
+        sinfo = context.space_data
         row = layout.row(align=True)
         row.prop(sinfo, "show_report_debug", text="Debug")
         row.prop(sinfo, "show_report_info", text="Info")
index 54dde61e90a16f60792c5d3b344f52955f8bd2cb..3c55853e2e2eb7d946ac0cdabc4882f8f340a29c 100644 (file)
@@ -66,8 +66,6 @@ class LOGIC_HT_header(bpy.types.Header):
     def draw(self, context):
         layout = self.layout
 
-        st = context.space_data
-
         row = layout.row(align=True)
         row.template_header()
 
index 3ae1e35aaf84b3762bf8d7c2c07f00ec312a9309..937ccf6a8a360391162ac1c10e5711e399c64eb2 100644 (file)
@@ -353,7 +353,6 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
         scene = context.scene
-        render = context.scene.render
         frame_current = scene.frame_current
         strip = act_strip(context)
 
index e8d80f79ad894a152b038ed10c895ad16a013a49..7ebf47d290a54685a312ddbb4e8b9e286511ad8d 100644 (file)
@@ -817,7 +817,6 @@ class USERPREF_PT_input(InputKeyMapPanel):
         #start = time.time()
 
         userpref = context.user_preferences
-        wm = context.window_manager
 
         inputs = userpref.inputs
 
@@ -871,9 +870,6 @@ class USERPREF_PT_addons(bpy.types.Panel):
         import sys
         import time
 
-        modules = []
-        loaded_modules = set()
-
         # RELEASE SCRIPTS: official scripts distributed in Blender releases
         paths = bpy.utils.script_paths("addons")
 
@@ -885,9 +881,6 @@ class USERPREF_PT_addons(bpy.types.Panel):
         # if folder addons_extern/ exists, scripts in there will be loaded too
         paths += bpy.utils.script_paths("addons_extern")
 
-        if bpy.app.debug:
-            t_main = time.time()
-
         # fake module importing
         def fake_module(mod_name, mod_path, speedy=True):
             if bpy.app.debug:
index a78ef1be36fd07979c799e5642197e6788d2618c..34d461fbef214cbf6be4469d7a304e67e452bd59 100644 (file)
@@ -676,7 +676,6 @@ class WM_OT_keymap_edit(bpy.types.Operator):
     bl_label = "Edit Key Map"
 
     def execute(self, context):
-        wm = context.window_manager
         km = context.keymap
         km.copy_to_user()
         return {'FINISHED'}
@@ -715,7 +714,6 @@ class WM_OT_keyitem_restore(bpy.types.Operator):
         return km.is_user_defined
 
     def execute(self, context):
-        wm = context.window_manager
         km = context.keymap
         kmi = km.items.from_id(self.item_id)
 
@@ -779,7 +777,6 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
         return wm.keyconfigs.active.is_user_defined
 
     def execute(self, context):
-        import sys
         wm = context.window_manager
         keyconfig = wm.keyconfigs.active
         wm.keyconfigs.remove(keyconfig)
index d401b779efb00c25000f4dfac70d45b26255afe5..5b23fd6d5c21bb28fe1fed9e013f696b7aefc88a 100644 (file)
@@ -647,10 +647,11 @@ class VIEW3D_MT_select_face(bpy.types.Menu):  # XXX no matching enum
     bl_label = "Select"
 
     def draw(self, context):
-        layout = self.layout
+        layout = self.layout
 
         # TODO
         # see view3d_select_faceselmenu
+        pass
 
 # ********** Object menu **********
 
@@ -1151,8 +1152,6 @@ class VIEW3D_MT_pose(bpy.types.Menu):
     def draw(self, context):
         layout = self.layout
 
-        arm = context.active_object.data
-
         layout.operator("ed.undo")
         layout.operator("ed.redo")
 
@@ -1447,7 +1446,7 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator):
 
         totface = mesh.total_face_sel
         totedge = mesh.total_edge_sel
-        totvert = mesh.total_vert_sel
+        totvert = mesh.total_vert_sel
 
         if select_mode[2] and totface == 1:
             bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
@@ -1475,7 +1474,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator):
 
         totface = mesh.total_face_sel
         totedge = mesh.total_edge_sel
-        totvert = mesh.total_vert_sel
+        totvert = mesh.total_vert_sel
 
         if totface >= 1:
             bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)})
@@ -1958,7 +1957,6 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel):
         layout = self.layout
 
         view = context.space_data
-        scene = context.scene
 
         col = layout.column()
         col.active = view.region_3d.view_perspective != 'CAMERA'
index 163e02817a40efa1a114dc0fda836de265338f5b..563eeb5e893d05d45c18da722e408d32178bf974 100644 (file)
@@ -782,8 +782,9 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
 
         settings = __class__.paint_settings(context)
         brush = settings.brush
-        texture_paint = context.texture_paint_object
-        sculpt = context.sculpt_object
+        ## Unused
+        # texture_paint = context.texture_paint_object
+        # sculpt = context.sculpt_object
 
         col = layout.column(align=True)
 
@@ -941,7 +942,6 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel):
         tool_settings = context.tool_settings
         sculpt = tool_settings.sculpt
         settings = __class__.paint_settings(context)
-        brush = settings.brush
 
         split = layout.split()
 
@@ -978,7 +978,6 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel):
 
         sculpt = context.tool_settings.sculpt
         settings = __class__.paint_settings(context)
-        brush = settings.brush
 
         split = layout.split()
 
@@ -1011,7 +1010,6 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
 
-        sculpt = context.tool_settings.sculpt
         settings = __class__.paint_settings(context)
         brush = settings.brush