[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33978] trunk/blender: pep8 cleanup

Campbell Barton ideasman42 at gmail.com
Sat Jan 1 08:20:35 CET 2011


Revision: 33978
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33978
Author:   campbellbarton
Date:     2011-01-01 08:20:34 +0100 (Sat, 01 Jan 2011)

Log Message:
-----------
pep8 cleanup

Modified Paths:
--------------
    trunk/blender/intern/tools/pydna.py
    trunk/blender/release/getversion.py
    trunk/blender/release/scripts/modules/animsys_refactor.py
    trunk/blender/release/scripts/modules/bpy/__init__.py
    trunk/blender/release/scripts/modules/bpy/ops.py
    trunk/blender/release/scripts/modules/bpy/path.py
    trunk/blender/release/scripts/modules/bpy/utils.py
    trunk/blender/release/scripts/modules/bpy_types.py
    trunk/blender/release/scripts/modules/rna_prop_ui.py
    trunk/blender/release/scripts/modules/sys_info.py
    trunk/blender/release/scripts/op/animsys_update.py
    trunk/blender/release/scripts/op/console_python.py
    trunk/blender/release/scripts/op/io_anim_bvh/__init__.py
    trunk/blender/release/scripts/op/io_anim_bvh/import_bvh.py
    trunk/blender/release/scripts/op/io_mesh_ply/export_ply.py
    trunk/blender/release/scripts/op/io_scene_3ds/__init__.py
    trunk/blender/release/scripts/op/io_scene_obj/__init__.py
    trunk/blender/release/scripts/op/io_scene_obj/export_obj.py
    trunk/blender/release/scripts/op/io_shape_mdd/__init__.py
    trunk/blender/release/scripts/op/io_shape_mdd/export_mdd.py
    trunk/blender/release/scripts/op/io_shape_mdd/import_mdd.py
    trunk/blender/release/scripts/op/object.py
    trunk/blender/release/scripts/op/object_align.py
    trunk/blender/release/scripts/op/object_randomize_transform.py
    trunk/blender/release/scripts/op/presets.py
    trunk/blender/release/scripts/op/uv.py
    trunk/blender/release/scripts/op/wm.py
    trunk/blender/release/scripts/ui/properties_data_bone.py
    trunk/blender/release/scripts/ui/properties_data_curve.py
    trunk/blender/release/scripts/ui/properties_data_modifier.py
    trunk/blender/release/scripts/ui/properties_object.py
    trunk/blender/release/scripts/ui/properties_object_constraint.py
    trunk/blender/release/scripts/ui/properties_render.py
    trunk/blender/release/scripts/ui/properties_scene.py
    trunk/blender/release/scripts/ui/properties_texture.py
    trunk/blender/release/scripts/ui/properties_world.py
    trunk/blender/release/scripts/ui/space_dopesheet.py
    trunk/blender/release/scripts/ui/space_filebrowser.py
    trunk/blender/release/scripts/ui/space_graph.py
    trunk/blender/release/scripts/ui/space_image.py
    trunk/blender/release/scripts/ui/space_info.py
    trunk/blender/release/scripts/ui/space_sequencer.py
    trunk/blender/release/scripts/ui/space_time.py
    trunk/blender/release/scripts/ui/space_userpref.py
    trunk/blender/release/scripts/ui/space_userpref_keymap.py
    trunk/blender/release/scripts/ui/space_view3d.py
    trunk/blender/release/scripts/ui/space_view3d_toolbar.py
    trunk/blender/release/test/pep8.py

Modified: trunk/blender/intern/tools/pydna.py
===================================================================
--- trunk/blender/intern/tools/pydna.py	2011-01-01 06:38:11 UTC (rev 33977)
+++ trunk/blender/intern/tools/pydna.py	2011-01-01 07:20:34 UTC (rev 33978)
@@ -68,13 +68,13 @@
         while type(getattr(other, "_type_", "")) != str:
             other = other._type_
         return other
-    
+
     class MixIn:
         pass
-    
+
     blend_cdll = ctypes.CDLL("")
     blend_lib = ctypes.LibraryLoader("")
-    
+
     def blend_parse_dna():
         # from dna.c
         sdna_str_pt = blend_cdll.DNAstr
@@ -85,14 +85,14 @@
         sdna_len = ctypes.c_int.from_address(sdna_len_pt.value)
 
         blend_sdna = ctypes.string_at(sdna_str_pt, sdna_len)
-        
+
         ofs = 0
         assert(blend_sdna[ofs:ofs + 8] == b'SDNANAME')
         ofs += 8
 
         sdna_names_len = struct.unpack("i", blend_sdna[ofs:ofs + 4])[0]
         ofs += 4
-        
+
         blend_sdna_names = blend_sdna[ofs:].split(b'\0', sdna_names_len)
         blend_sdna_remainder = blend_sdna_names.pop(-1)  # last item is not a name.
         ofs = len(blend_sdna) - len(blend_sdna_remainder)
@@ -103,7 +103,7 @@
 
         sdna_types_len = struct.unpack("i", blend_sdna[ofs:ofs + 4])[0]
         ofs += 4
-        
+
         blend_sdna_types = blend_sdna[ofs:].split(b'\0', sdna_types_len)
         blend_sdna_remainder = blend_sdna_types.pop(-1)
         ofs = len(blend_sdna) - len(blend_sdna_remainder)
@@ -119,7 +119,7 @@
         # array of pointers to short arrays
         assert(blend_sdna[ofs:ofs + 4] == b'STRC')
         ofs += 4
-        
+
         sdna_structs_len = struct.unpack("i", blend_sdna[ofs:ofs + 4])[0]
         ofs += 4
 
@@ -129,29 +129,29 @@
             struct_type, struct_tot = struct.unpack("hh", blend_sdna[ofs:ofs + 4])
             ofs += 4
             struct_type_name_pairs = struct.unpack("%dh" % struct_tot * 2, blend_sdna[ofs:ofs + (struct_tot * 4)])
-        
+
             # convert into pairs, easier to understand (type, name)
             struct_type_name_pairs = [(struct_type_name_pairs[j], struct_type_name_pairs[j + 1]) for j in range(0, struct_tot * 2, 2)]
 
             blend_sdna_structs.append((struct_type, struct_type_name_pairs))
             ofs += struct_tot * 4
             # ofs = (ofs + 1) & ~1
-        
+
         return blend_sdna_names, blend_sdna_types, blend_sdna_typelens, blend_sdna_structs
 
     def create_dna_structs(blend_sdna_names, blend_sdna_types, blend_sdna_typelens, blend_sdna_structs):
-        
+
         # create all subclasses of ctypes.Structure
         ctypes_structs = {name: type(name.decode(), (ctypes.Structure, MixIn), {}) for name in blend_sdna_types}
         ctypes_basic = {b"float": ctypes.c_float, b"double": ctypes.c_double, b"int": ctypes.c_int, b"short": ctypes.c_short, b"char": ctypes.c_char, b"void": ctypes.c_void_p}
         ctypes_fields = {}
-        
+
         # collect fields
         for struct_id, struct_type_name_pairs in blend_sdna_structs:
             struct_name = blend_sdna_types[struct_id]
             ctype_struct = ctypes_structs[struct_name]
             fields = []
-            
+
             for stype, sname in struct_type_name_pairs:
                 name_string = blend_sdna_names[sname]
                 type_string = blend_sdna_types[stype]
@@ -168,20 +168,20 @@
                 while name_string[0] == 42:  # '*'
                     pointer_count += 1
                     name_string = name_string[1:]
-                
+
                 # alredy a pointer
                 if type_py is ctypes.c_void_p:
                     pointer_count -= 1
                 elif type_py is ctypes.c_char and pointer_count == 1:
                     type_py = ctypes.c_char_p
                     pointer_count = 0
-                
+
                 if pointer_count < 0:
                     Exception("error parsing pointer")
 
                 for i in range(pointer_count):
                     type_py = ctypes.POINTER(type_py)
-                
+
                 # * Now parse the array [] *
                 if b'[' in name_string:
                     name_string = name_string.replace(b'[', b' ')
@@ -194,7 +194,7 @@
                 fields.append((name_string.decode(), type_py))
 
             ctypes_fields[struct_name] = fields
-        
+
         # apply fields all in one go!
         for struct_id, struct_type_name_pairs in blend_sdna_structs:
             struct_name = blend_sdna_types[struct_id]
@@ -216,11 +216,11 @@
         return ctypes_structs
 
     def decorate_api(struct_dict):
-        
+
         # * Decotate the api *
-        
+
         # listbase iter
-        
+
         type_cast_lb = struct_dict[b'ListBase']
         type_cast_link = struct_dict[b'Link']
 
@@ -246,11 +246,11 @@
                 yield return_value
 
         struct_dict[b'ListBase'].ITER = list_base_iter
-        
+
         def CAST(self, to):
             type_cast = struct_dict[to.encode('ASCII')]
             return type_cast.from_address(ctypes.addressof(self))
-        
+
         MixIn.CAST = CAST
 
     blend_sdna_names, blend_sdna_types, blend_sdna_typelens, blend_sdna_structs = blend_parse_dna()
@@ -266,9 +266,9 @@
             print("    %s %s;" % (blend_sdna_types[stype].decode(), blend_sdna_names[sname].decode()))
         print("} %s;" % sruct_name)
     '''
-    
+
     decorate_api(struct_dict)  # not essential but useful
-    
+
     # manually wrap Main
     Main = type("Main", (ctypes.Structure, ), {})
     _lb = struct_dict[b"ListBase"]
@@ -316,7 +316,7 @@
     # main is the first pointer in Global.
     main_address = ctypes.POINTER(ctypes.c_void_p).from_address(ctypes.addressof(blend_cdll.G)).contents.value
     main = Main.from_address(main_address)
-    
+
     return main, struct_dict
 
 main, _struct_dict = _api()

Modified: trunk/blender/release/getversion.py
===================================================================
--- trunk/blender/release/getversion.py	2011-01-01 06:38:11 UTC (rev 33977)
+++ trunk/blender/release/getversion.py	2011-01-01 07:20:34 UTC (rev 33978)
@@ -57,7 +57,7 @@
 infile.close()
 
 # Major was changed to float, but minor is still a string
-# Note: removed returning minor, this messes up with install path code in BLI module
+# Note: removed returning minor, messes up install path code in BLI module
 if major:
     print "%.2f" % major
 else:

Modified: trunk/blender/release/scripts/modules/animsys_refactor.py
===================================================================
--- trunk/blender/release/scripts/modules/animsys_refactor.py	2011-01-01 06:38:11 UTC (rev 33977)
+++ trunk/blender/release/scripts/modules/animsys_refactor.py	2011-01-01 07:20:34 UTC (rev 33978)
@@ -22,11 +22,12 @@
 This module has utility functions for renaming
 rna values in fcurves and drivers.
 
-The main function to use is: update_data_paths(...) 
+The main function to use is: update_data_paths(...)
 """
 
 IS_TESTING = False
 
+
 class DataPathBuilder(object):
     __slots__ = ("data_path", )
     """ Dummy class used to parse fcurve and driver data paths.
@@ -37,7 +38,7 @@
     def __getattr__(self, attr):
         str_value = ".%s" % attr
         return DataPathBuilder(self.data_path + (str_value, ))
-        
+
     def __getitem__(self, key):
         str_value = '["%s"]' % key
         return DataPathBuilder(self.data_path + (str_value, ))
@@ -51,7 +52,7 @@
             if base is not Ellipsis:
                 try:
                     # this only works when running with an old blender
-                    # where the old path will resolve 
+                    # where the old path will resolve
                     base = eval("base" + item)
                 except:
                     base_new = Ellipsis
@@ -61,7 +62,7 @@
                             try:
                                 print("base." + item_new)
                                 base_new = eval("base." + item_new)
-                                break # found, dont keep looking
+                                break  # found, dont keep looking
                             except:
                                 pass
 
@@ -77,7 +78,7 @@
 
 def id_iter():
     type_iter = type(bpy.data.objects)
-    
+
     for attr in dir(bpy.data):
         data_iter = getattr(bpy.data, attr, None)
         if type(data_iter) == type_iter:
@@ -115,13 +116,13 @@
     # ignore ID props for now
     if data_path.startswith("["):
         return data_path
-    
+
     # recursive path fixing, likely will be one in most cases.
     data_path_builder = eval("DataPathBuilder(tuple())." + data_path)
     data_resolve = data_path_builder.resolve(id_data, rna_update_from_map)
 
     path_new = [pair[0] for pair in data_resolve]
-    
+
     # print(data_resolve)
     data_base = id_data
 
@@ -138,20 +139,20 @@
 
         # set this as the base for further properties
         data_base = data
-    
-    data_path_new = "".join(path_new)[1:] # skip the first "."
+
+    data_path_new = "".join(path_new)[1:]  # skip the first "."
     return data_path_new
 
 
 def update_data_paths(rna_update):
     ''' rna_update triple [(class_name, from, to), ...]
     '''
-    
+
     # make a faster lookup dict
     rna_update_dict = {}
     for ren_class, ren_from, ren_to in rna_update:
         rna_update_dict.setdefault(ren_class, {})[ren_from] = ren_to
-        
+
     rna_update_from_map = {}
     for ren_class, ren_from, ren_to in rna_update:
         rna_update_from_map.setdefault(ren_from, []).append(ren_to)
@@ -174,7 +175,7 @@
                         for tar in var.targets:
                             id_data_other = tar.id
                             data_path = tar.data_path
-                            
+
                             if id_data_other and data_path:
                                 data_path_new = find_path_new(id_data_other, data_path, rna_update_dict, rna_update_from_map)
                                 # print(data_path_new)
@@ -182,9 +183,7 @@
                                     if not IS_TESTING:
                                         tar.data_path = data_path_new
                                     print("driver (%s): %s -> %s" % (id_data_other.name, data_path, data_path_new))
-                    
-                
-            
+
             for action in anim_data_actions(anim_data):
                 for fcu in action.fcurves:

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list