pep8 edits and avoid naming conflicts with python builtins
authorCampbell Barton <ideasman42@gmail.com>
Thu, 24 Nov 2011 19:36:12 +0000 (19:36 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 24 Nov 2011 19:36:12 +0000 (19:36 +0000)
19 files changed:
build_files/buildbot/master.cfg
build_files/buildbot/slave_pack.py
doc/python_api/examples/bge.texture.1.py
intern/cycles/blender/CMakeLists.txt
intern/cycles/blender/addon/properties.py
intern/cycles/blender/addon/ui.py
intern/cycles/blender/addon/xml.py
release/scripts/modules/addon_utils.py
release/scripts/modules/bpy/utils.py
release/scripts/modules/console/complete_calltip.py
release/scripts/startup/bl_ui/properties_data_modifier.py
release/scripts/startup/bl_ui/properties_render.py
release/scripts/startup/bl_ui/space_clip.py
source/blender/blenloader/intern/writefile.c
source/blender/gpu/CMakeLists.txt
source/blender/python/mathutils/mathutils_Euler.c
source/blender/python/mathutils/mathutils_Matrix.c
source/blender/python/mathutils/mathutils_Quaternion.c
source/tests/pep8.py

index 5aa5a43abf75785768ea9330572f083f727cfe09..23751f7dcd49a6a072c58a70fac979580cb2d791 100644 (file)
@@ -75,14 +75,14 @@ def svn_step(branch=''):
         return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/blender', mode='update', defaultBranch='trunk', workdir='blender')
 
 
         return SVN(baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/blender', mode='update', defaultBranch='trunk', workdir='blender')
 
 
-def lib_svn_step(dir):
-    return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + dir, mode='update', defaultBranch='trunk', workdir='lib/' + dir)
+def lib_svn_step(libdir):
+    return SVN(name='lib svn', baseURL='https://svn.blender.org/svnroot/bf-blender/%%BRANCH%%/lib/' + libdir, mode='update', defaultBranch='trunk', workdir='lib/' + libdir)
 
 # generic builder
 
 
 
 # generic builder
 
 
-def generic_builder(id, libdir='', branch=''):
-    filename = 'buildbot_upload_' + id + '.zip'
+def generic_builder(idname, libdir='', branch=''):
+    filename = 'buildbot_upload_' + idname + '.zip'
     compile_script = '../blender/build_files/buildbot/slave_compile.py'
     test_script = '../blender/build_files/buildbot/slave_test.py'
     pack_script = '../blender/build_files/buildbot/slave_pack.py'
     compile_script = '../blender/build_files/buildbot/slave_compile.py'
     test_script = '../blender/build_files/buildbot/slave_test.py'
     pack_script = '../blender/build_files/buildbot/slave_pack.py'
@@ -93,10 +93,10 @@ def generic_builder(id, libdir='', branch=''):
     if libdir != '':
         f.addStep(lib_svn_step(libdir))
 
     if libdir != '':
         f.addStep(lib_svn_step(libdir))
 
-    f.addStep(Compile(command=['python', compile_script, id]))
-    f.addStep(Test(command=['python', test_script, id]))
-    f.addStep(ShellCommand(name='package', command=['python', pack_script, id, branch], description='packaging', descriptionDone='packaged'))
-    if id.find('cmake') != -1:
+    f.addStep(Compile(command=['python', compile_script, idname]))
+    f.addStep(Test(command=['python', test_script, idname]))
+    f.addStep(ShellCommand(name='package', command=['python', pack_script, idname, branch], description='packaging', descriptionDone='packaged'))
+    if 'cmake' in idname:
         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024))
     else:
         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024, workdir='install'))
         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024))
     else:
         f.addStep(FileUpload(name='upload', slavesrc='buildbot_upload.zip', masterdest=filename, maxsize=100 * 1024 * 1024, workdir='install'))
index af8d99893b4409687529e9fd984e5b2ed2864dc6..94640803aae8e564d86b0a565afaeb13606c091a 100644 (file)
@@ -84,12 +84,12 @@ if builder.find('scons') != -1:
         sys.exit(retcode)
 
 # clean release directory if it already exists
         sys.exit(retcode)
 
 # clean release directory if it already exists
-dir = 'release'
+release_dir = '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(release_dir):
+    for f in os.listdir(release_dir):
+        if os.path.isfile(os.path.join(release_dir, f)):
+            os.remove(os.path.join(release_dir, f))
 
 # create release package
 try:
 
 # create release package
 try:
@@ -99,16 +99,16 @@ except Exception, ex:
     sys.exit(1)
 
 # find release directory, must exist this time
     sys.exit(1)
 
 # find release directory, must exist this time
-if not os.path.exists(dir):
-    sys.stderr.write("Failed to find release directory.\n")
+if not os.path.exists(release_dir):
+    sys.stderr.write("Failed to find release directory %r.\n" % release_dir)
     sys.exit(1)
 
 # find release package
 file = None
 filepath = None
 
     sys.exit(1)
 
 # find release package
 file = None
 filepath = None
 
-for f in os.listdir(dir):
-    rf = os.path.join(dir, f)
+for f in os.listdir(release_dir):
+    rf = os.path.join(release_dir, f)
     if os.path.isfile(rf) and f.startswith('blender'):
         file = f
         filepath = rf
     if os.path.isfile(rf) and f.startswith('blender'):
         file = f
         filepath = rf
index 4be6f51de67cf2aefed4333f3f15e7bdcfe891ec..918ffc9772d66e9a8ae33d09841588c424651b5a 100644 (file)
@@ -11,13 +11,13 @@ from bge import texture
 
 def createTexture(cont):
     """Create a new Dynamic Texture"""
 
 def createTexture(cont):
     """Create a new Dynamic Texture"""
-    object = cont.owner
+    obj = cont.owner
 
     # get the reference pointer (ID) of the internal texture
 
     # get the reference pointer (ID) of the internal texture
-    ID = texture.materialID(object, 'IMoriginal.png')
+    ID = texture.materialID(obj, 'IMoriginal.png')
 
     # create a texture object
 
     # create a texture object
-    object_texture = texture.Texture(object, ID)
+    object_texture = texture.Texture(obj, ID)
 
     # create a new source with an external image
     url = logic.expandPath("//newtexture.jpg")
 
     # create a new source with an external image
     url = logic.expandPath("//newtexture.jpg")
index e81f02f2090f7287520feb848ba22e5ba4989b99..b96048acf054fb1db502b5e21465dc759cb0afbb 100644 (file)
@@ -6,7 +6,7 @@ set(INC
        ../kernel/svm
        ../util
        ../subd
        ../kernel/svm
        ../util
        ../subd
-       ../../../intern/guardedalloc
+       ../../guardedalloc
        ../../../source/blender/makesdna
        ../../../source/blender/makesrna
        ../../../source/blender/blenloader
        ../../../source/blender/makesdna
        ../../../source/blender/makesrna
        ../../../source/blender/blenloader
index 0c7deb01ed8c4ab25edee700fc734edc37796886..21d49b03ea3ea763736ff1ea6ce89cefee2ea6c6 100644 (file)
 # <pep8 compliant>
 
 import bpy
 # <pep8 compliant>
 
 import bpy
-from bpy.props import *
+from bpy.props import (EnumProperty,
+                       FloatProperty,
+                       IntProperty,
+                       PointerProperty)
 
 import math
 
 
 import math
 
index f3ed3b677fb5f35055181c615aef2e4b16781cdd..224e44c287aa2c0785006d0f14da413aa3435bae 100644 (file)
@@ -349,7 +349,7 @@ def find_node(material, nodetype):
         ntree = material.node_tree
 
         for node in ntree.nodes:
         ntree = material.node_tree
 
         for node in ntree.nodes:
-            if hasattr(node, 'type') and node.type == nodetype:
+            if getattr(node, "type", None) == nodetype:
                 return node
 
     return None
                 return node
 
     return None
@@ -363,14 +363,14 @@ def find_node_input(node, name):
     return None
 
 
     return None
 
 
-def panel_node_draw(layout, id, output_type, input_name):
-    if not id.node_tree:
-        layout.prop(id, "use_nodes", icon='NODETREE')
+def panel_node_draw(layout, id_data, output_type, input_name):
+    if not id_data.node_tree:
+        layout.prop(id_data, "use_nodes", icon='NODETREE')
         return False
 
         return False
 
-    ntree = id.node_tree
+    ntree = id_data.node_tree
 
 
-    node = find_node(id, output_type)
+    node = find_node(id_data, output_type)
     if not node:
         layout.label(text="No output node.")
     else:
     if not node:
         layout.label(text="No output node.")
     else:
index e64023f046b8031a11c85e7db7861daa56f9ce5f..f17051d92dc18a5d97d0eb31576600301953bbdd 100644 (file)
@@ -61,12 +61,12 @@ class ExportCyclesXML(bpy.types.Operator, ExportHelper):
 
         # get mesh
         scene = context.scene
 
         # get mesh
         scene = context.scene
-        object = context.object
+        obj = context.object
 
 
-        if not object:
+        if not obj:
             raise Exception("No active object")
 
             raise Exception("No active object")
 
-        mesh = object.to_mesh(scene, True, 'PREVIEW')
+        mesh = obj.to_mesh(scene, True, 'PREVIEW')
 
         if not mesh:
             raise Exception("No mesh data in active object")
 
         if not mesh:
             raise Exception("No mesh data in active object")
index bcde4ce1e18d36451e947e5d6376236934953831..de662b47c4dc65444724c6f38d7daccefd34c22d 100644 (file)
@@ -171,7 +171,9 @@ def modules(module_cache):
                     mod = None
 
             if mod is None:
                     mod = None
 
             if mod is None:
-                mod = fake_module(mod_name, mod_path, force_support=force_support)
+                mod = fake_module(mod_name,
+                                  mod_path,
+                                  force_support=force_support)
                 if mod:
                     module_cache[mod_name] = mod
 
                 if mod:
                     module_cache[mod_name] = mod
 
index 6eb16bd7e7ac53cbc719ad3c83c6e0fdf8ae9c9a..cf3e92bdcbfe7834864bc5b7aa821e0fc5798e63 100644 (file)
@@ -263,7 +263,7 @@ def user_script_path():
         return None
 
 
         return None
 
 
-def script_paths(subdir=None, user_pref=True, all=False):
+def script_paths(subdir=None, user_pref=True, check_all=False):
     """
     Returns a list of valid script paths.
 
     """
     Returns a list of valid script paths.
 
@@ -271,9 +271,9 @@ def script_paths(subdir=None, user_pref=True, all=False):
     :type subdir: string
     :arg user_pref: Include the user preference script path.
     :type user_pref: bool
     :type subdir: string
     :arg user_pref: Include the user preference script path.
     :type user_pref: bool
-    :arg all: Include local, user and system paths rather just the paths
+    :arg check_all: Include local, user and system paths rather just the paths
        blender uses.
        blender uses.
-    :type all: bool
+    :type check_all: bool
     :return: script paths.
     :rtype: list
     """
     :return: script paths.
     :rtype: list
     """
@@ -286,7 +286,7 @@ def script_paths(subdir=None, user_pref=True, all=False):
     else:
         user_script_path = None
 
     else:
         user_script_path = None
 
-    if all:
+    if check_all:
         # all possible paths
         base_paths = tuple(_os.path.join(resource_path(res), "scripts")
                            for res in ('LOCAL', 'USER', 'SYSTEM'))
         # all possible paths
         base_paths = tuple(_os.path.join(resource_path(res), "scripts")
                            for res in ('LOCAL', 'USER', 'SYSTEM'))
@@ -343,7 +343,7 @@ def preset_paths(subdir):
     :rtype: list
     """
     dirs = []
     :rtype: list
     """
     dirs = []
-    for path in script_paths("presets", all=True):
+    for path in script_paths("presets", check_all=True):
         directory = _os.path.join(path, subdir)
         if not directory.startswith(path):
             raise Exception("invalid subdir given %r" % subdir)
         directory = _os.path.join(path, subdir)
         if not directory.startswith(path):
             raise Exception("invalid subdir given %r" % subdir)
@@ -432,9 +432,9 @@ def keyconfig_set(filepath):
     keyconfigs_old = keyconfigs[:]
 
     try:
     keyconfigs_old = keyconfigs[:]
 
     try:
-        file = open(filepath)
-        exec(compile(file.read(), filepath, 'exec'), {"__file__": filepath})
-        file.close()
+        keyfile = open(filepath)
+        exec(compile(keyfile.read(), filepath, 'exec'), {"__file__": filepath})
+        keyfile.close()
     except:
         import traceback
         traceback.print_exc()
     except:
         import traceback
         traceback.print_exc()
index 29187297707eafb96d7ee5f3c6ec7efc9f043a04..3404bb792faad8b92583cb557ce1cd34df78ef18 100644 (file)
@@ -72,7 +72,7 @@ def reduce_spaces(text):
     return RE_SPACE.sub(' ', text)
 
 
     return RE_SPACE.sub(' ', text)
 
 
-def get_doc(object):
+def get_doc(obj):
     """Get the doc string or comments for an object.
 
     :param object: object
     """Get the doc string or comments for an object.
 
     :param object: object
@@ -82,7 +82,7 @@ def get_doc(object):
     >>> get_doc(abs)
     'abs(number) -> number\\n\\nReturn the absolute value of the argument.'
     """
     >>> get_doc(abs)
     'abs(number) -> number\\n\\nReturn the absolute value of the argument.'
     """
-    result = inspect.getdoc(object) or inspect.getcomments(object)
+    result = inspect.getdoc(obj) or inspect.getcomments(obj)
     return result and RE_EMPTY_LINE.sub('', result.rstrip()) or ''
 
 
     return result and RE_EMPTY_LINE.sub('', result.rstrip()) or ''
 
 
index d5b8b9d110d8159b918ff224966f902c3a495719..5e9f863d22bccb7d113b89cbb3f5abae74797e54 100644 (file)
@@ -454,15 +454,15 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         layout.separator()
 
         layout.prop(md, "use_normals")
         layout.separator()
 
         layout.prop(md, "use_normals")
-        
+
         split = layout.split()
         split = layout.split()
-        
+
         col = split.column()
         col.prop(md, "use_foam")
         sub = col.row()
         sub.active = md.use_foam
         sub.prop(md, "foam_coverage", text="Coverage")
         col = split.column()
         col.prop(md, "use_foam")
         sub = col.row()
         sub.active = md.use_foam
         sub.prop(md, "foam_coverage", text="Coverage")
-        
+
         col = split.column()
         col.active = md.use_foam
         col.label("Foam Data Layer Name:")
         col = split.column()
         col.active = md.use_foam
         col.label("Foam Data Layer Name:")
index 57df602f19a08492b2a783ca1ec63f5ec4a7d12e..d5350e81a88a9fb033d5c0ded105edb72baae0e4 100644 (file)
@@ -456,7 +456,7 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
         file_format = rd.image_settings.file_format
 
         layout.prop(rd, "filepath", text="")
         file_format = rd.image_settings.file_format
 
         layout.prop(rd, "filepath", text="")
-        
+
         flow = layout.column_flow()
         flow.prop(rd, "use_overwrite")
         flow.prop(rd, "use_placeholder")
         flow = layout.column_flow()
         flow.prop(rd, "use_overwrite")
         flow.prop(rd, "use_placeholder")
index e0e7e88f620a4f1a2af7f5f29ad05d54a71c23c9..b04d81b6b2a6aeaab2b24bb3e239796a30ac8a7e 100644 (file)
@@ -475,7 +475,7 @@ class CLIP_PT_stabilization(Panel):
 
     def draw_header(self, context):
         stab = context.space_data.clip.tracking.stabilization
 
     def draw_header(self, context):
         stab = context.space_data.clip.tracking.stabilization
-        
+
         self.layout.prop(stab, "use_2d_stabilization", text="")
 
     def draw(self, context):
         self.layout.prop(stab, "use_2d_stabilization", text="")
 
     def draw(self, context):
index 2bb70ce20b517e8cccaaa7fd0a74f4f117beb2fd..c5e59959ddd2520b7c66638499a105a53b8d8d31 100644 (file)
@@ -1666,7 +1666,8 @@ static void write_customdata(WriteData *wd, ID *id, int count, CustomData *data,
                                writestruct(wd, DATA, structname, datasize, layer->data);
                        }
                        else
                                writestruct(wd, DATA, structname, datasize, layer->data);
                        }
                        else
-                               printf("error: this CustomDataLayer must not be written to file\n");
+                               printf("%s error: layer '%s':%d - can't be written to file\n",
+                                      __func__, structname, layer->type);
                }
        }
 
                }
        }
 
index 4488442815d19be4a6b0741164bc504c5c0b6c26..01afc0e24eb5c9892911f6c620cf7572374821ad 100644 (file)
@@ -31,8 +31,11 @@ set(INC
        ../imbuf
        ../makesdna
        ../makesrna
        ../imbuf
        ../makesdna
        ../makesrna
-       ../nodes        # For node muting stuff...
-       ../nodes/intern # For node muting stuff...
+
+       # For node muting stuff...
+       ../nodes
+       ../nodes/intern
+
        ../../../intern/guardedalloc
        ../../../intern/smoke/extern
 )
        ../../../intern/guardedalloc
        ../../../intern/smoke/extern
 )
index a1e18432b4bada2e4c86479a3de89b66d04b7c3f..9bf6687fb5ee1341c487a17357eda4004f0ac768 100644 (file)
@@ -241,7 +241,7 @@ static PyObject *Euler_rotate(EulerObject * self, PyObject *value)
                return NULL;
 
        eulO_to_mat3(self_rmat, self->eul, self->order);
                return NULL;
 
        eulO_to_mat3(self_rmat, self->eul, self->order);
-       mul_m3_m3m3(rmat, self_rmat, other_rmat);
+       mul_m3_m3m3(rmat, other_rmat, self_rmat);
 
        mat3_to_compatible_eulO(self->eul, self->eul, self->order, rmat);
 
 
        mat3_to_compatible_eulO(self->eul, self->eul, self->order, rmat);
 
index f5e1218aaa363bff522493f3ef1fe48492550cdd..2f62f7141cf59af4185c66abff6dea79e8971e01 100644 (file)
@@ -1041,7 +1041,7 @@ static PyObject *Matrix_rotate(MatrixObject *self, PyObject *value)
        }
 
        matrix_as_3x3(self_rmat, self);
        }
 
        matrix_as_3x3(self_rmat, self);
-       mul_m3_m3m3(rmat, self_rmat, other_rmat);
+       mul_m3_m3m3(rmat, other_rmat, self_rmat);
 
        copy_m3_m3((float (*)[3])(self->contigPtr), rmat);
 
 
        copy_m3_m3((float (*)[3])(self->contigPtr), rmat);
 
index 0b24db708e26e72f56eca5727d87b26a48262fa9..44cd28a7c3d0eaf152fa55cff1c8fce1442820ae 100644 (file)
@@ -312,7 +312,7 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
 
        length= normalize_qt_qt(tquat, self->quat);
        quat_to_mat3(self_rmat, tquat);
 
        length= normalize_qt_qt(tquat, self->quat);
        quat_to_mat3(self_rmat, tquat);
-       mul_m3_m3m3(rmat, self_rmat, other_rmat);
+       mul_m3_m3m3(rmat, other_rmat, self_rmat);
 
        mat3_to_quat(self->quat, rmat);
        mul_qt_fl(self->quat, length); /* maintain length after rotating */
 
        mat3_to_quat(self->quat, rmat);
        mul_qt_fl(self->quat, length); /* maintain length after rotating */
index 0c7c90a238286c0c5a4815644e0eaab10a2e8cd9..4b957f2090706a83be36b5a75782c8cd24713436 100644 (file)
@@ -122,12 +122,13 @@ def main():
                   "W0232,"  # class has no __init__, Operator/Panel/Menu etc
                   "W0142,"  # Used * or ** magic
                             # even needed in some cases
                   "W0232,"  # class has no __init__, Operator/Panel/Menu etc
                   "W0142,"  # Used * or ** magic
                             # even needed in some cases
-                  "R0903,"  # bake_action] Too many statements (68/50)
+                  "R0902,"  # Too many instance attributes
+                  "R0903,"  # Too many statements
                   "R0911,"  # Too many return statements
                   "R0912,"  # Too many branches
                   "R0913,"  # Too many arguments
                   "R0914,"  # Too many local variables
                   "R0911,"  # Too many return statements
                   "R0912,"  # Too many branches
                   "R0913,"  # Too many arguments
                   "R0914,"  # Too many local variables
-                  "R0915,"  # bake_action] Too many statements (68/50)
+                  "R0915,"  # Too many statements
                   " "
                   "--include-ids=y "
                   "--output-format=parseable "
                   " "
                   "--include-ids=y "
                   "--output-format=parseable "