[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3713] contrib/py/scripts/addons: code cleanup: python - pass multiple args to string startswith() / endswith() functions rather than calling multiple times.

Campbell Barton ideasman42 at gmail.com
Tue Sep 4 22:32:10 CEST 2012


Revision: 3713
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3713
Author:   campbellbarton
Date:     2012-09-04 20:32:09 +0000 (Tue, 04 Sep 2012)
Log Message:
-----------
code cleanup: python - pass multiple args to string startswith() / endswith() functions rather than calling multiple times.

Modified Paths:
--------------
    contrib/py/scripts/addons/io_import_LRO_Lola_MGS_Mola_img.py
    contrib/py/scripts/addons/io_sequencer_edl/import_edl.py

Modified: contrib/py/scripts/addons/io_import_LRO_Lola_MGS_Mola_img.py
===================================================================
--- contrib/py/scripts/addons/io_import_LRO_Lola_MGS_Mola_img.py	2012-09-04 20:31:19 UTC (rev 3712)
+++ contrib/py/scripts/addons/io_import_LRO_Lola_MGS_Mola_img.py	2012-09-04 20:32:09 UTC (rev 3713)
@@ -537,7 +537,7 @@
                 split = col.split(align=True)
                 split.label("Message: " + Message)
 
-            if bpy.context.scene.fpath.upper().endswith("IMG") or bpy.context.scene.fpath.upper().endswith("LBL"):  # Check if is selected the correct file
+            if bpy.context.scene.fpath.upper().endswith(("IMG", "LBL")):  # Check if is selected the correct file
                 VertNumbers = (((RealLat(bpy.context.scene.FromLat) - RealLat(bpy.context.scene.ToLat)) * MAP_RESOLUTION) + 1) * ((RealLong(bpy.context.scene.ToLong) - RealLong(bpy.context.scene.FromLong)) * MAP_RESOLUTION + 1)
             else:
                 VertNumbers = 0

Modified: contrib/py/scripts/addons/io_sequencer_edl/import_edl.py
===================================================================
--- contrib/py/scripts/addons/io_sequencer_edl/import_edl.py	2012-09-04 20:31:19 UTC (rev 3712)
+++ contrib/py/scripts/addons/io_sequencer_edl/import_edl.py	2012-09-04 20:32:09 UTC (rev 3713)
@@ -452,7 +452,7 @@
         for line in file:
             line = " ".join(line.split())
 
-            if not line or line.startswith("*") or line.startswith("#"):
+            if not line or line.startswith(("*", "#")):
                 continue
             elif line.startswith("TITLE:"):
                 self.title = " ".join(line.split()[1:])



More information about the Bf-extensions-cvs mailing list