pep8 checker, mostly pedantic style changes but also found an error in mesh_utils.mesh_linked_faces()

This commit is contained in:
Campbell Barton 2011-04-01 02:41:15 +00:00
parent 14e94d742e
commit c8652b301f
17 changed files with 44 additions and 49 deletions

@ -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)

@ -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

@ -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)

@ -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([

@ -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")

@ -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[:]

@ -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])

@ -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.

@ -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

@ -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):

@ -19,7 +19,6 @@
# <pep8 compliant>
import bpy
import os
class AddPresetBase():

@ -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"
@ -875,6 +876,7 @@ class WM_OT_appconfig_default(bpy.types.Operator):
return {'FINISHED'}
class WM_OT_appconfig_activate(bpy.types.Operator):
bl_idname = "wm.appconfig_activate"
bl_label = "Activate Application Configuration"
@ -892,6 +894,7 @@ class WM_OT_appconfig_activate(bpy.types.Operator):
return {'FINISHED'}
class WM_OT_sysinfo(bpy.types.Operator):
'''Generate System Info'''
bl_idname = "wm.sysinfo"

@ -17,8 +17,6 @@
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
import bpy
# Generic Panels (Independent of DataType)

@ -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"

@ -1,5 +1,4 @@
import bpy
from bpy.props import IntProperty, FloatProperty
class ModalTimerOperator(bpy.types.Operator):

@ -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')