code cleanup: python - pass multiple args to string startswith() / endswith() functions rather than calling multiple times.
This commit is contained in:
parent
1d4316f35f
commit
dba5ef3ba8
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue