code cleanup: python - pass multiple args to string startswith() / endswith() functio...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 4 Sep 2012 20:26:42 +0000 (20:26 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 4 Sep 2012 20:26:42 +0000 (20:26 +0000)
release/scripts/modules/addon_utils.py
source/blender/makesrna/rna_cleanup/rna_cleaner.py
source/tests/pep8.py

index 433d9024e0ac2996caff4387f7f646b2634903d9..485b4829b71c3e416ce0d7ba3fa1e411ffb2dd7d 100644 (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
index b75d177d80989c0f0aead05c21db310e9a21398e..e3359fbae59bfcbbacc0ca234afab5bb6568d1a4 100755 (executable)
@@ -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:
index d12397ea81d7e7018477670182156ec9d62b3a0d..ccaaeb7c0cdf7b6b60f31bf1c7203646a931ba3f 100644 (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)