Cleanup: use static sets where possible

This commit is contained in:
Campbell Barton 2014-09-18 17:45:31 +10:00
parent cf0ce0afc7
commit 90f75b8ce0
5 changed files with 7 additions and 7 deletions

View File

@ -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"):

View 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'}

View 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

View 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):

View 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)