Code cleanup: unused python vars & imports

Use frosted rather then pyflakes
This commit is contained in:
Campbell Barton 2014-04-25 05:31:20 +10:00
parent 16443b1ae0
commit a15be34389
31 changed files with 24 additions and 61 deletions

@ -62,7 +62,7 @@ Sphinx: PDF generation
try:
import bpy # blender module
except:
except ImportError:
print("\nERROR: this script must run from inside Blender")
print(SCRIPT_HELP_MSG)
import sys

@ -571,7 +571,7 @@ class CyclesObject_PT_motion_blur(CyclesButtonsPanel, Panel):
rd = context.scene.render
scene = context.scene
cscene = scene.cycles
# cscene = scene.cycles
layout.active = rd.use_motion_blur
@ -585,7 +585,7 @@ class CyclesObject_PT_motion_blur(CyclesButtonsPanel, Panel):
rd = context.scene.render
scene = context.scene
cscene = scene.cycles
# cscene = scene.cycles
ob = context.object
cob = ob.cycles
@ -1194,7 +1194,7 @@ class CyclesRender_PT_CurveRendering(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
scene = context.scene
cscene = scene.cycles
# cscene = scene.cycles
psys = context.particle_system
return CyclesButtonsPanel.poll(context) and psys and psys.settings.type == 'HAIR'
@ -1233,7 +1233,7 @@ class CyclesParticle_PT_CurveSettings(CyclesButtonsPanel, Panel):
@classmethod
def poll(cls, context):
scene = context.scene
cscene = scene.cycles
# cscene = scene.cycles
ccscene = scene.cycles_curves
psys = context.particle_system
use_curves = ccscene.use_curves and psys

@ -229,9 +229,9 @@ def check(module_name):
def _addon_ensure(module_name):
addons = _user_preferences.addons
addon = _user_preferences.addons.get(module_name)
addon = addons.get(module_name)
if not addon:
addon = _user_preferences.addons.new()
addon = addons.new()
addon.module = module_name

@ -73,16 +73,11 @@ def region_2d_to_origin_3d(region, rv3d, coord):
:return: The origin of the viewpoint in 3d space.
:rtype: :class:`mathutils.Vector`
"""
from mathutils import Vector
viewinv = rv3d.view_matrix.inverted()
if rv3d.is_perspective:
from mathutils.geometry import intersect_line_plane
origin_start = viewinv.translation.copy()
else:
from mathutils.geometry import intersect_point_line
persmat = rv3d.perspective_matrix.copy()
dx = (2.0 * coord[0] / region.width) - 1.0
dy = (2.0 * coord[1] / region.height) - 1.0

@ -18,7 +18,6 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu, Panel
class NodeCategory():
@ -92,7 +91,6 @@ def register_node_categories(identifier, cat_list):
def draw_node_item(self, context):
layout = self.layout
col = layout.column()
default_context = bpy.app.translations.contexts.default
for item in self.category.items(context):
item.draw(item, col, context)

@ -292,7 +292,6 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout):
kmi_type_set.add(v)
return kmi_type_set
kmi_type_set_combine = None
for i, kmi_type in enumerate(filter_text_split):
kmi_type_set = kmi_type_set_from_string(kmi_type)

@ -22,7 +22,6 @@ from bpy.types import Operator
from bpy.props import (FloatProperty,
IntProperty,
BoolProperty,
)
from bpy.app.translations import pgettext_data as data_

@ -87,7 +87,6 @@ class MeshMirrorUV(Operator):
polys = mesh.polygons
loops = mesh.loops
verts = mesh.vertices
uv_loops = mesh.uv_layers.active.data
nbr_polys = len(polys)

@ -61,7 +61,6 @@ class NodeAddOperator():
@staticmethod
def store_mouse_cursor(context, event):
space = context.space_data
v2d = context.region.view2d
tree = space.edit_tree
# convert mouse position to the View2D for later node placement

@ -687,7 +687,6 @@ class TransformsToDeltasAnim(Operator):
DELTA_PATHS = STANDARD_TO_DELTA_PATHS.values()
# try to apply on each selected object
success = False
for obj in context.selected_editable_objects:
adt = obj.animation_data
if (adt is None) or (adt.action is None):
@ -792,7 +791,6 @@ class LodByName(Operator):
return (context.active_object is not None)
def execute(self, context):
scene = context.scene
ob = context.active_object
prefix = ""
@ -843,7 +841,6 @@ class LodClearAll(Operator):
return (context.active_object is not None)
def execute(self, context):
scene = context.scene
ob = context.active_object
if ob.lod_levels:

@ -183,7 +183,6 @@ class VertexPaintDirt(Operator):
def execute(self, context):
import time
from math import radians
obj = context.object
mesh = obj.data

@ -19,7 +19,6 @@
# <pep8-80 compliant>
import bpy
import mathutils
from bpy.types import Operator
from bpy.props import BoolProperty

@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu, Operator
from bpy.types import Operator
from bpy.props import (StringProperty,
BoolProperty,
IntProperty,

@ -195,7 +195,6 @@ class UI_UL_list(bpy.types.UIList):
return a list mapping org_idx -> new_idx,
or an empty list if no sorting has been done.
"""
neworder = [None] * len(items)
_sort = [(idx, getattr(it, propname, "")) for idx, it in enumerate(items)]
return cls.sort_items_helper(_sort, lambda e: e[1].lower())

@ -292,7 +292,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
return (context.object) and (context.armature)
def draw(self, context):
layout = self.layout
# layout = self.layout
ob = context.object
avs = ob.pose.animation_visualization

@ -76,7 +76,7 @@ class MESH_UL_shape_keys(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# assert(isinstance(item, bpy.types.ShapeKey)
obj = active_data
key = data
# key = data
key_block = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
split = layout.split(0.66, False)
@ -323,7 +323,6 @@ class DATA_PT_uv_texture(MeshButtonsPanel, Panel):
layout = self.layout
me = context.mesh
lay = me.uv_textures.active
row = layout.row()
col = row.column()
@ -343,7 +342,6 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, Panel):
layout = self.layout
me = context.mesh
lay = me.vertex_colors.active
row = layout.row()
col = row.column()

@ -377,7 +377,6 @@ class MASK_MT_select(Menu):
def draw(self, context):
layout = self.layout
sc = context.space_data
layout.operator("mask.select_border")
layout.operator("mask.select_circle")

@ -73,7 +73,7 @@ class MATERIAL_MT_specials(Menu):
class MATERIAL_UL_matslots(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# assert(isinstance(item, bpy.types.MaterialSlot)
ob = data
# ob = data
slot = item
ma = slot.material
if self.layout_type in {'DEFAULT', 'COMPACT'}:

@ -324,7 +324,7 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):
return (context.object)
def draw(self, context):
layout = self.layout
# layout = self.layout
ob = context.object
avs = ob.animation_visualization

@ -18,7 +18,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu, Panel, UIList
from bpy.types import Panel, UIList
class RenderLayerButtonsPanel():

@ -182,7 +182,6 @@ class SCENE_PT_color_management(SceneButtonsPanel, Panel):
layout = self.layout
scene = context.scene
rd = scene.render
col = layout.column()
col.label(text="Display:")

@ -262,7 +262,6 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
sc = context.space_data
clip = sc.clip
settings = clip.tracking.settings
col = layout.column(align=True)
row = col.row(align=True)
@ -641,7 +640,6 @@ class CLIP_PT_plane_track(CLIP_PT_tracking_panel, Panel):
def draw(self, context):
layout = self.layout
sc = context.space_data
clip = context.space_data.clip
active_track = clip.tracking.plane_tracks.active
@ -1086,7 +1084,6 @@ class CLIP_PT_footage_info(CLIP_PT_clip_view_panel, Panel):
layout = self.layout
sc = context.space_data
clip = sc.clip
col = layout.column()
col.template_movieclip_information(sc, "clip", sc.clip_user)

@ -458,7 +458,6 @@ class MASK_MT_editor_menus(Menu):
sima = context.space_data
ima = sima.image
show_render = sima.show_render
show_uvedit = sima.show_uvedit
show_maskedit = sima.show_maskedit
@ -759,7 +758,6 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
toolsettings = context.tool_settings.image_paint
brush = toolsettings.brush
tex_slot = brush.texture_slot
col = layout.column()
col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
@ -775,7 +773,6 @@ class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel):
layout = self.layout
brush = context.tool_settings.image_paint.brush
tex_slot_alpha = brush.mask_texture_slot
col = layout.column()

@ -274,7 +274,6 @@ class NODE_PT_active_node_generic(Panel):
@classmethod
def poll(cls, context):
space = context.space_data
return context.active_node is not None
def draw(self, context):
@ -293,7 +292,6 @@ class NODE_PT_active_node_color(Panel):
@classmethod
def poll(cls, context):
space = context.space_data
return context.active_node is not None
def draw_header(self, context):
@ -323,7 +321,6 @@ class NODE_PT_active_node_properties(Panel):
@classmethod
def poll(cls, context):
space = context.space_data
return context.active_node is not None
def draw(self, context):

@ -486,7 +486,6 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
sequencer = context.scene.sequence_editor
strip = act_strip(context)
if strip.input_count > 0:

@ -30,8 +30,7 @@ class VIEW3D_HT_header(Header):
layout = self.layout
view = context.space_data
mode_string = context.mode
edit_object = context.edit_object
# mode_string = context.mode
obj = context.active_object
toolsettings = context.tool_settings
@ -2793,8 +2792,6 @@ class VIEW3D_PT_view3d_display(Panel):
view = context.space_data
scene = context.scene
gs = scene.game_settings
obj = context.object
col = layout.column()
col.prop(view, "show_only_render")

@ -1100,7 +1100,6 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
settings = self.paint_settings(context)
brush = settings.brush
tex_slot = brush.texture_slot
col = layout.column()
@ -1124,7 +1123,6 @@ class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel):
layout = self.layout
brush = context.tool_settings.image_paint.brush
tex_slot_alpha = brush.mask_texture_slot
col = layout.column()

@ -164,7 +164,6 @@ def dice(filepath, output, output_prefix, name_style,
minx_icon, miny_icon, maxx_icon, maxy_icon,
spacex_icon, spacey_icon,
):
import struct
is_simple = (max(minx, miny, maxx, maxy,
minx_icon, miny_icon, maxx_icon, maxy_icon,
@ -209,7 +208,7 @@ def dice(filepath, output, output_prefix, name_style,
# simple, no margins
if is_simple:
sub_x = x * icon_x
sub_x = x * icon_w
sub_y = y * icon_h
else:
sub_x = minx + ((x * (icon_w + spacex_icon)) + minx_icon)

@ -96,7 +96,7 @@ def test_urls():
import rna_wiki_reference
import urllib.error
from urllib.request import urlopen
from urllib.request import urlopen
prefix = rna_wiki_reference.url_manual_prefix
urls = {suffix for (rna_id, suffix) in rna_wiki_reference.url_manual_mapping}
@ -118,7 +118,7 @@ def test_urls():
print(" %s ... " % url_full, end="")
sys.stdout.flush()
try:
urllib.request.urlopen(url_full)
urlopen(url_full)
print(color_green + "OK" + color_normal)
except urllib.error.HTTPError:
print(color_red + "FAIL!" + color_normal)

@ -20,15 +20,16 @@
import os
# depends on pep8, pyflakes, pylint
# depends on pep8, frosted, pylint
# for Ubuntu
#
# sudo apt-get install pylint pyflakes
# sudo apt-get install pylint
#
# sudo apt-get install python-setuptools python-pip
# sudo pip install pep8
# sudo pip install frosted
#
# in Debian install pylint pyflakes pep8 with apt-get/aptitude/etc
# in Debian install pylint pep8 with apt-get/aptitude/etc
#
# on *nix run
# python source/tests/pep8.py > test_pep8.log 2>&1
@ -118,10 +119,10 @@ def main():
os.system("pep8 --repeat --ignore=%s '%s'" % (",".join(ignore_tmp), f))
# pyflakes
print("\n\n\n# running pyflakes...")
# frosted
print("\n\n\n# running frosted...")
for f, pep8_type in files:
os.system("pyflakes '%s'" % f)
os.system("frosted '%s'" % f)
print("\n\n\n# running pylint...")
for f, pep8_type in files:

@ -50,7 +50,6 @@ def parse_rst_py(filepath):
indent_map = {}
indent_prev = 0
f = open(filepath, encoding="utf-8")
indent_lists = []
for i, line in enumerate(f):
line_strip = line.lstrip()
# ^\.\.\s[a-zA-Z09\-]+::.*$