[yum-cvs] yum/yum config.py,1.116,1.117 depsolve.py,1.156,1.157

James Bowes jbowes at linux.duke.edu
Wed Apr 4 12:17:45 UTC 2007


Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv29339/yum

Modified Files:
	config.py depsolve.py 
Log Message:
Micro optimization: replace string.startswith(<single char>) with comparison.


Index: config.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/config.py,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- config.py	5 Mar 2007 19:39:12 -0000	1.116
+++ config.py	4 Apr 2007 12:17:43 -0000	1.117
@@ -591,7 +591,7 @@
 
     # Check that plugin paths are all absolute
     for path in startupconf.pluginpath:
-        if not path.startswith('/'):
+        if not path[0] == '/':
             raise Errors.ConfigError("All plugin search paths must be absolute")
 
     # Stuff this here to avoid later re-parsing

Index: depsolve.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/depsolve.py,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -r1.156 -r1.157
--- depsolve.py	3 Apr 2007 21:24:24 -0000	1.156
+++ depsolve.py	4 Apr 2007 12:17:43 -0000	1.157
@@ -1097,7 +1097,7 @@
                 continue
             if newpoprovs.has_key(prov):
                 continue
-            if not prov[0].startswith("/"):
+            if not prov[0][0] == "/":
                 goneprovs[prov[0]] = prov
             else:
                 gonefiles[prov[0]] = prov
@@ -1119,7 +1119,7 @@
                 prov = None
                 if r in goneprovs.keys():
                     prov = goneprovs[r]
-                elif r.startswith("/") and r in gonefiles:
+                elif r[0] == "/" and r in gonefiles:
                     prov = gonefiles[r]
 
                 if prov and not removes.has_key(prov):
@@ -1207,7 +1207,7 @@
             # advantage of the shortcut of the files globbed into
             # primary.xml.gz.  this is a bit of a hack, but saves us
             # from having to download the filelists for a lot of cases
-            if r.startswith("/"):
+            if r[0] == "/":
                 for po in self.pkgSack.searchProvides(r):
                     if self.tsInfo.getMembers(po.pkgtup, TS_INSTALL_STATES):
                         isok = True
@@ -1235,7 +1235,7 @@
                         break
 
                 # FIXME: it's ugly to have to check files separately here
-                elif r.startswith("/") and r in txmbr.po.filelist:
+                elif r[0] == "/" and r in txmbr.po.filelist:
                     isok = True
                     break
 




More information about the Yum-cvs-commits mailing list