[Bf-blender-cvs] [90f75b8] master: Cleanup: use static sets where possible

Campbell Barton noreply at git.blender.org
Thu Sep 18 09:48:14 CEST 2014


Commit: 90f75b8ce034068f0f8192e32d4b9a6d9261393f
Author: Campbell Barton
Date:   Thu Sep 18 17:45:31 2014 +1000
Branches: master
https://developer.blender.org/rB90f75b8ce034068f0f8192e32d4b9a6d9261393f

Cleanup: use static sets where possible

===================================================================

M	build_files/cmake/cmake_consistency_check.py
M	doc/python_api/examples/bpy.types.Operator.5.py
M	doc/python_api/sphinx_doc_gen.py
M	release/scripts/modules/console/complete_namespace.py
M	tests/python/rna_array.py

===================================================================

diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py
index c2044fc..2e0eeb1 100755
--- a/build_files/cmake/cmake_consistency_check.py
+++ b/build_files/cmake/cmake_consistency_check.py
@@ -174,7 +174,7 @@ def cmake_get_src(f):
                             elif is_c(new_file):
                                 sources_c.append(new_file)
                                 global_refs.setdefault(new_file, []).append((f, i))
-                            elif l in ("PARENT_SCOPE", ):
+                            elif l in {"PARENT_SCOPE", }:
                                 # cmake var, ignore
                                 pass
                             elif new_file.endswith(".list"):
diff --git a/doc/python_api/examples/bpy.types.Operator.5.py b/doc/python_api/examples/bpy.types.Operator.5.py
index 4a0abcb..78030c7 100644
--- a/doc/python_api/examples/bpy.types.Operator.5.py
+++ b/doc/python_api/examples/bpy.types.Operator.5.py
@@ -39,7 +39,7 @@ class ModalOperator(bpy.types.Operator):
             self.execute(context)
         elif event.type == 'LEFTMOUSE':  # Confirm
             return {'FINISHED'}
-        elif event.type in ('RIGHTMOUSE', 'ESC'):  # Cancel
+        elif event.type in {'RIGHTMOUSE', 'ESC'}:  # Cancel
             context.object.location.x = self.init_loc_x
             return {'CANCELLED'}
 
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 1915b03..0b9a4e6 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -695,7 +695,7 @@ def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
         fw(ident + ".. data:: %s\n\n" % identifier)
         write_indented_lines(ident + "   ", fw, doc, False)
         fw("\n")
-    elif type(descr) in (MethodDescriptorType, ClassMethodDescriptorType):
+    elif type(descr) in {MethodDescriptorType, ClassMethodDescriptorType}:
         write_indented_lines(ident, fw, doc, False)
         fw("\n")
     else:
@@ -889,7 +889,7 @@ def pymodule2sphinx(basepath, module_name, module, title):
     for attribute, value, value_type in module_dir_value_type:
         if value_type == types.FunctionType:
             pyfunc2sphinx("", fw, module_name, None, attribute, value, is_class=False)
-        elif value_type in (types.BuiltinMethodType, types.BuiltinFunctionType):  # both the same at the moment but to be future proof
+        elif value_type in {types.BuiltinMethodType, types.BuiltinFunctionType}:  # both the same at the moment but to be future proof
             # note: can't get args from these, so dump the string as is
             # this means any module used like this must have fully formatted docstrings.
             py_c_func2sphinx("", fw, module_name, None, attribute, value, is_class=False)
@@ -1871,7 +1871,7 @@ def rna2sphinx(basepath):
     if "bpy.context" not in EXCLUDE_MODULES:
         # one of a kind, context doc (uses ctypes to extract info!)
         # doesn't work on mac and windows
-        if PLATFORM not in ["darwin", "windows"]:
+        if PLATFORM not in {"darwin", "windows"}:
             pycontext2sphinx(basepath)
 
     # internal modules
diff --git a/release/scripts/modules/console/complete_namespace.py b/release/scripts/modules/console/complete_namespace.py
index 74406d5..992bb72 100644
--- a/release/scripts/modules/console/complete_namespace.py
+++ b/release/scripts/modules/console/complete_namespace.py
@@ -186,7 +186,7 @@ def complete(word, namespace, private=True):
         except Exception:
             return []
         # ignore basic types
-        if type(obj) in (bool, float, int, str):
+        if type(obj) in {bool, float, int, str}:
             return []
         # an extra char '[', '(' or '.' will be added
         if hasattr(obj, '__getitem__') and not is_struct_seq(obj):
diff --git a/tests/python/rna_array.py b/tests/python/rna_array.py
index d301486..f9777a5 100644
--- a/tests/python/rna_array.py
+++ b/tests/python/rna_array.py
@@ -266,7 +266,7 @@ def prop_to_list(prop):
     ret= []
 
     for x in prop:
-        if type(x) not in (bool, int, float):
+        if type(x) not in {bool, int, float}:
             ret.append(prop_to_list(x))
         else:
             ret.append(x)




More information about the Bf-blender-cvs mailing list