Cleanup: use static sets where possible
authorCampbell Barton <ideasman42@gmail.com>
Thu, 18 Sep 2014 07:45:31 +0000 (17:45 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 18 Sep 2014 07:45:31 +0000 (17:45 +1000)
build_files/cmake/cmake_consistency_check.py
doc/python_api/examples/bpy.types.Operator.5.py
doc/python_api/sphinx_doc_gen.py
release/scripts/modules/console/complete_namespace.py
tests/python/rna_array.py

index c2044fcc21d69f9b09620142b4a9310c294eee5e..2e0eeb1e0672227743b7697748bfd410f82732ec 100755 (executable)
@@ -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"):
index 4a0abcb62c3baeb1557fcc019c784aac6beec0f9..78030c7d7c4017d6f925645d2e70e9373e56dda5 100644 (file)
@@ -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'}
 
index 1915b0394230491767dc8edfe0b74bb0775f902a..0b9a4e6a37bcdf64c9c6a0ca6bdad02e1e8eb3a4 100644 (file)
@@ -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
index 74406d5e002d2aac33d7bb5a327b8bca489b7d8e..992bb72aa085c8f0e158f71ba4d546bc7c9748d6 100644 (file)
@@ -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):
index d3014868bcbd5d6e7537b97d7e044e34768ab1bd..f9777a5b438b401d535f443ae0d86914df18509d 100644 (file)
@@ -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)