diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-09-18 11:45:31 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-09-18 11:45:31 +0400 |
commit | 90f75b8ce034068f0f8192e32d4b9a6d9261393f (patch) | |
tree | 9d56098c6816a02f4396273fd1927b1b234a41ba | |
parent | cf0ce0afc7b79cc42fbf083da0e7deacf54a836f (diff) |
Cleanup: use static sets where possible
-rwxr-xr-x | build_files/cmake/cmake_consistency_check.py | 2 | ||||
-rw-r--r-- | doc/python_api/examples/bpy.types.Operator.5.py | 2 | ||||
-rw-r--r-- | doc/python_api/sphinx_doc_gen.py | 6 | ||||
-rw-r--r-- | release/scripts/modules/console/complete_namespace.py | 2 | ||||
-rw-r--r-- | tests/python/rna_array.py | 2 |
5 files changed, 7 insertions, 7 deletions
diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py index c2044fcc21d..2e0eeb1e067 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 4a0abcb62c3..78030c7d7c4 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 1915b039423..0b9a4e6a37b 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 74406d5e002..992bb72aa08 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 d3014868bcb..f9777a5b438 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) |