Cleanup: unused variables
authorCampbell Barton <ideasman42@gmail.com>
Sun, 17 Mar 2019 10:13:25 +0000 (21:13 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 17 Mar 2019 10:14:43 +0000 (21:14 +1100)
18 files changed:
release/scripts/modules/addon_utils.py
release/scripts/modules/bl_keymap_utils/io.py
release/scripts/modules/bl_previews_utils/bl_previews_render.py
release/scripts/modules/bpy/utils/__init__.py
release/scripts/modules/bpy_extras/image_utils.py
release/scripts/modules/bpy_extras/node_shader_utils.py
release/scripts/startup/bl_operators/add_mesh_torus.py
release/scripts/startup/bl_ui/properties_data_gpencil.py
release/scripts/startup/bl_ui/properties_grease_pencil_common.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/properties_render.py
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_topbar.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py
tests/python/pep8.py

index 4e7c278..f2e799f 100644 (file)
@@ -470,7 +470,7 @@ def reset_all(*, reload_scripts=False):
 
     for path in paths_list:
         _bpy.utils._sys_path_ensure(path)
-        for mod_name, mod_path in _bpy.path.module_names(path):
+        for mod_name, _mod_path in _bpy.path.module_names(path):
             is_enabled, is_loaded = check(mod_name)
 
             # first check if reload is needed before changing state.
index 531c620..d8ac647 100644 (file)
@@ -156,7 +156,7 @@ def keyconfig_export_as_data(wm, kc, filepath, *, all_keymaps=False):
         fw = fh.write
         fw("keyconfig_data = \\\n[")
 
-        for km, kc_x in export_keymaps:
+        for km, _kc_x in export_keymaps:
             km = km.active()
             fw("(")
             fw(f"\"{km.name:s}\",\n")
index f7e0f6e..804bf24 100644 (file)
@@ -284,7 +284,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern):
             camera = bpy.data.objects[render_context.camera, None]
             light = bpy.data.objects[render_context.light, None] if render_context.light is not None else None
             cos = objects_bbox_calc(camera, objects, offset_matrix)
-            loc, ortho_scale = camera.camera_fit_coords(bpy.context.depsgraph, cos)
+            loc, _ortho_scale = camera.camera_fit_coords(bpy.context.depsgraph, cos)
             camera.location = loc
             # Set camera clipping accordingly to computed bbox.
             min_dist = 1e24
@@ -298,7 +298,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern):
             camera.data.clip_start = min_dist / 2
             camera.data.clip_end = max_dist * 2
             if light:
-                loc, ortho_scale = light.camera_fit_coords(bpy.context.depsgraph, cos)
+                loc, _ortho_scale = light.camera_fit_coords(bpy.context.depsgraph, cos)
                 light.location = loc
         scene.update()
 
index 81b62b5..7d4909f 100644 (file)
@@ -137,7 +137,7 @@ def modules_from_path(path, loaded_modules):
     """
     modules = []
 
-    for mod_name, mod_path in _bpy.path.module_names(path):
+    for mod_name, _mod_path in _bpy.path.module_names(path):
         mod = _test_import(mod_name, loaded_modules)
         if mod:
             modules.append(mod)
@@ -868,7 +868,6 @@ def unregister_tool(tool_cls):
             del tool_list[-1]
         while tool_list and tool_list[0] is None:
             del tool_list[0]
-        is_none_prev = False
         # Remove duplicate separators.
         for i in range(len(tool_list) - 1, -1, -1):
             is_none = tool_list[i] is None
index 63850b6..03864d6 100644 (file)
@@ -138,7 +138,7 @@ def load_image(imagepath,
 
     def _recursive_search(paths, filename_check):
         for path in paths:
-            for dirpath, dirnames, filenames in os.walk(path):
+            for dirpath, _dirnames, filenames in os.walk(path):
 
                 # skip '.svn'
                 if dirpath[0] in {".", b'.'}:
index 83cf94b..1e83a24 100644 (file)
@@ -131,7 +131,7 @@ class ShaderWrapper():
         if self._node_texcoords is None and not self.is_readonly:
             tree = self.material.node_tree
             nodes = tree.nodes
-            links = tree.links
+            links = tree.links
 
             node_texcoords = nodes.new(type='ShaderNodeTexCoord')
             node_texcoords.label = "Texture Coords"
@@ -521,8 +521,8 @@ class ShaderImageTextureWrapper():
         self._node_mapping = ...
 
         tree = node_dst.id_data
-        nodes = tree.nodes
-        links = tree.links
+        nodes = tree.nodes
+        links = tree.links
 
         if socket_dst.is_linked:
             from_node = socket_dst.links[0].from_node
index 7d30b4e..e449512 100644 (file)
@@ -99,10 +99,10 @@ def add_uvs(mesh, minor_seg, major_seg):
 
     u_prev = u_init
     u_next = u_prev + u_step
-    for major_index in range(major_seg):
+    for _major_index in range(major_seg):
         v_prev = v_init
         v_next = v_prev + v_step
-        for minor_index in range(minor_seg):
+        for _minor_index in range(minor_seg):
             loops = polygons[vertex_index].loop_indices
             uv_data[loops[0]].uv = u_prev, v_prev
             uv_data[loops[1]].uv = u_next, v_prev
index 90cdbac..2374faa 100644 (file)
@@ -68,7 +68,6 @@ class DATA_PT_context_gpencil(DataButtonsPanel, Panel):
         layout = self.layout
 
         ob = context.object
-        gpencil = context.gpencil
         space = context.space_data
 
         if ob:
index ed75e21..1994bfd 100644 (file)
@@ -249,7 +249,6 @@ class GreasePencilStrokeSculptPanel:
         layout.use_property_decorate = False
 
         settings = context.tool_settings.gpencil_sculpt
-        tool = settings.sculpt_tool
         brush = settings.brush
 
         layout.template_icon_view(settings, "sculpt_tool", show_labels=True)
index 3d25829..e2504ba 100644 (file)
@@ -1000,7 +1000,6 @@ class PARTICLE_PT_physics_fluid_interaction(ParticleButtonsPanel, Panel):
         layout.use_property_split = True
 
         psys = context.particle_system
-        part = particle_get_settings(context)
 
         row = layout.row()
         row.template_list("UI_UL_list", "particle_targets", psys, "targets",
index a05f3c9..193ab6e 100644 (file)
@@ -491,7 +491,6 @@ class RENDER_PT_eevee_film(RenderButtonsPanel, Panel):
         layout.use_property_split = True
 
         scene = context.scene
-        props = scene.eevee
         rd = scene.render
 
         col = layout.column()
index 39c3597..00bfc48 100644 (file)
@@ -383,8 +383,6 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
     def draw(self, context):
         layout = self.layout
 
-        sc = context.space_data
-
         col = layout.column(align=True)
         row = col.row(align=True)
         row.operator("clip.add_marker_at_click", text="Add")
index d1d4d15..73c3f63 100644 (file)
@@ -719,7 +719,6 @@ class IMAGE_PT_view_display(Panel):
         ima = sima.image
 
         show_uvedit = sima.show_uvedit
-        show_maskedit = sima.show_maskedit
         uvedit = sima.uv_editor
 
         col = layout.column()
index 4b21f5e..4cda267 100644 (file)
@@ -294,10 +294,11 @@ class _draw_left_context_mode:
             if tool is None:
                 return
 
-            is_paint = True
+            is_paint = True
             # FIXME: tools must use their own UI drawing!
             if tool.idname in {"builtin.line", "builtin.box", "builtin.circle", "builtin.arc", "builtin.curve"}:
-                is_paint = False
+                # is_paint = False
+                pass
             elif tool.idname == "Cutter":
                 row = layout.row(align=True)
                 row.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold")
index d1fd250..5b87dd0 100644 (file)
@@ -1518,7 +1518,6 @@ class USERPREF_PT_input_tablet(PreferencePanel, Panel):
     @classmethod
     def poll(cls, context):
         prefs = context.preferences
-        inputs = prefs.inputs
         return prefs.active_section == 'INPUT'
 
     def draw_props(self, context, layout):
index 867ecf0..d0e278a 100644 (file)
@@ -135,7 +135,6 @@ class VIEW3D_HT_header(Header):
         # Orientation
         if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL'} or has_pose_mode:
             orient_slot = scene.transform_orientation_slots[0]
-            custom_orientation = orient_slot.custom_orientation
             trans_name, trans_icon = orient_slot.ui_info()
 
             row = layout.row(align=True)
@@ -651,7 +650,6 @@ class VIEW3D_MT_view_local(Menu):
 
     def draw(self, context):
         layout = self.layout
-        view = context.space_data
 
         layout.operator("view3d.localview", text="Toggle Local View")
         layout.operator("view3d.localview_remove_from")
@@ -4333,13 +4331,14 @@ class VIEW3D_PT_collections(Panel):
                 need_separator = False
 
             icon = 'BLANK1'
-            has_objects = True
+            has_objects = True
             if child.has_selected_objects(view_layer):
                 icon = 'LAYER_ACTIVE'
             elif child.has_objects():
                 icon = 'LAYER_USED'
             else:
-                has_objects = False
+                # has_objects = False
+                pass
 
             row = layout.row()
             sub = row.split(factor=0.98)
@@ -4365,7 +4364,7 @@ class VIEW3D_PT_collections(Panel):
         layout.use_property_split = False
 
         layout.label(text="Collections Visibility")
-        col = layout.column()
+        layout.column()
 
         view_layer = context.view_layer
         # We pass index 0 here beause the index is increased
@@ -4891,7 +4890,6 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
 
         view = context.space_data
         overlay = view.overlay
-        shading = view.shading
         display_all = overlay.show_overlays
 
         col = layout.column()
index 0f73058..a37e54d 100644 (file)
@@ -1663,7 +1663,7 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves(View3DPanel, Panel):
         return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL'}
 
     def draw(self, context):
-        layout = self.layout
+        pass
 
 
 class VIEW3D_PT_tools_grease_pencil_brushcurves_sensitivity(View3DPanel, Panel):
index 78f0c82..fde8689 100644 (file)
@@ -45,7 +45,7 @@ FORCE_PEP8_ALL = False
 
 
 def file_list_py(path):
-    for dirpath, dirnames, filenames in os.walk(path):
+    for dirpath, _dirnames, filenames in os.walk(path):
         for filename in filenames:
             if filename.endswith((".py", ".cfg")):
                 yield os.path.join(dirpath, filename)