code cleanup: python - pass multiple args to string startswith() / endswith() functions rather than calling multiple times.

This commit is contained in:
Campbell Barton 2012-09-04 20:26:42 +00:00
parent 1d4316f35f
commit dba5ef3ba8
3 changed files with 3 additions and 3 deletions

View File

@ -148,7 +148,7 @@ def modules(module_cache):
for path in path_list:
# force all contrib addons to be 'TESTING'
if path.endswith("addons_contrib") or path.endswith("addons_extern"):
if path.endswith(("addons_contrib", "addons_extern")):
force_support = 'TESTING'
else:
force_support = None

View File

@ -60,7 +60,7 @@ def check_commandline():
usage()
if sys.argv[1] == '-h':
help()
elif not (sys.argv[1].endswith(".txt") or sys.argv[1].endswith(".py")):
elif not sys.argv[1].endswith((".txt", ".py")):
print ('\nBad input file extension... exiting.')
usage()
else:

View File

@ -43,7 +43,7 @@ FORCE_PEP8_ALL = False
def file_list_py(path):
for dirpath, dirnames, filenames in os.walk(path):
for filename in filenames:
if filename.endswith(".py") or filename.endswith(".cfg"):
if filename.endswith((".py", ".cfg")):
yield os.path.join(dirpath, filename)