[yum-cvs] yum/yum comps.py, 1.10.4.3, 1.10.4.4 depsolve.py, 1.105.2.3, 1.105.2.4 failover.py, 1.2.8.2, 1.2.8.3 mdparser.py, 1.5.4.2, 1.5.4.3 misc.py, 1.19.2.5, 1.19.2.6 packageSack.py, 1.18.2.5, 1.18.2.6 packages.py, 1.73.2.6, 1.73.2.7 pgpmsg.py, 1.5.4.2, 1.5.4.3 sqlitecache.py, 1.13.2.2, 1.13.2.3 update_md.py, 1.3.2.2, 1.3.2.3

James Bowes jbowes at linux.duke.edu
Tue Dec 5 14:39:37 UTC 2006


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

Modified Files:
      Tag: yum-3_0_X
	comps.py depsolve.py failover.py mdparser.py misc.py 
	packageSack.py packages.py pgpmsg.py sqlitecache.py 
	update_md.py 
Log Message:
Pychecker fixes back again, less the brokenness

Index: comps.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/comps.py,v
retrieving revision 1.10.4.3
retrieving revision 1.10.4.4
diff -u -r1.10.4.3 -r1.10.4.4
--- comps.py	5 Dec 2006 14:03:33 -0000	1.10.4.3
+++ comps.py	5 Dec 2006 14:39:34 -0000	1.10.4.4
@@ -261,7 +261,7 @@
                 self.translated_description[lang] = obj.translated_description[lang]
 
         
-class Comps:
+class Comps(object):
     def __init__(self, overwrite_groups=False):
         self._groups = {}
         self._categories = {}

Index: depsolve.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/depsolve.py,v
retrieving revision 1.105.2.3
retrieving revision 1.105.2.4
diff -u -r1.105.2.3 -r1.105.2.4
--- depsolve.py	5 Dec 2006 14:03:33 -0000	1.105.2.3
+++ depsolve.py	5 Dec 2006 14:39:34 -0000	1.105.2.4
@@ -14,12 +14,9 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 # Copyright 2005 Duke University 
 
-import os
-import os.path
 import re
 import types
 import logging
-import time
 
 import rpmUtils.transaction
 import rpmUtils.miscutils

Index: failover.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/failover.py,v
retrieving revision 1.2.8.2
retrieving revision 1.2.8.3
diff -u -r1.2.8.2 -r1.2.8.3
--- failover.py	5 Dec 2006 14:03:33 -0000	1.2.8.2
+++ failover.py	5 Dec 2006 14:39:34 -0000	1.2.8.3
@@ -72,7 +72,7 @@
         if index >= len(self.repo.urls):
             return None
         
-        return self.repos.urls[index]
+        return self.repo.urls[index]
         
         
     

Index: mdparser.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/mdparser.py,v
retrieving revision 1.5.4.2
retrieving revision 1.5.4.3
diff -u -r1.5.4.2 -r1.5.4.3
--- mdparser.py	5 Dec 2006 14:03:33 -0000	1.5.4.2
+++ mdparser.py	5 Dec 2006 14:39:34 -0000	1.5.4.3
@@ -17,10 +17,7 @@
 import gzip
 from cElementTree import iterparse
 
-try:
-    from cStringIO import StringIO
-except ImportError:
-    from StringIO import StringIO
+from cStringIO import StringIO
 
 #TODO: document everything here
 
@@ -50,9 +47,6 @@
         if not self._handlercls:
             raise ValueError('Unknown repodata type "%s" in %s' % (
                 elem.tag, filename))
-        # Get the total number of packages
-        total = elem.get('packages', None)
-        self.total = total is None and None or int(total)
 
     def __iter__(self):
         return self
@@ -153,14 +147,13 @@
                 p.update(self._prefixprops(child, 'rpm_header'))
 
             elif name == 'file':
-                type = child.get('type', 'file')
+                file_type = child.get('type', 'file')
                 path = child.text
-                self.files[path] = type
+                self.files[path] = file_type
 
     def getPrco(self, elem):
         members = []
         for child in elem:
-            name = self._bn(child.tag)
             members.append(child.attrib)
         return members
         
@@ -173,9 +166,9 @@
         for child in elem:
             name = self._bn(child.tag)
             if name == 'file':
-                type = child.get('type', 'file')
+                file_type = child.get('type', 'file')
                 path = child.text
-                self.files[path] = type
+                self.files[path] = file_type
         elem.clear()
                 
 class OtherEntry(BaseEntry):

Index: misc.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/misc.py,v
retrieving revision 1.19.2.5
retrieving revision 1.19.2.6
diff -u -r1.19.2.5 -r1.19.2.6
--- misc.py	5 Dec 2006 14:03:33 -0000	1.19.2.5
+++ misc.py	5 Dec 2006 14:39:34 -0000	1.19.2.6
@@ -1,5 +1,4 @@
 import types
-import string
 import os
 import os.path
 from cStringIO import StringIO
@@ -136,7 +135,7 @@
         if os.path.isdir(path + '/' + d):
             filelist = getFileList(path + '/' + d, ext, filelist)
         else:
-            if string.lower(d[-extlen:]) == '%s' % (ext):
+            if d[-extlen:].lower() == '%s' % (ext):
                newpath = os.path.normpath(path + '/' + d)
                filelist.append(newpath)
                     

Index: packageSack.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/packageSack.py,v
retrieving revision 1.18.2.5
retrieving revision 1.18.2.6
diff -u -r1.18.2.5 -r1.18.2.6
--- packageSack.py	5 Dec 2006 14:03:33 -0000	1.18.2.5
+++ packageSack.py	5 Dec 2006 14:39:34 -0000	1.18.2.6
@@ -22,7 +22,7 @@
 import re
 import fnmatch
 
-class PackageSackBase:
+class PackageSackBase(object):
     """Base class that provides the interface for PackageSacks."""
     def __init__(self):
         self.added = {}

Index: packages.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/packages.py,v
retrieving revision 1.73.2.6
retrieving revision 1.73.2.7
diff -u -r1.73.2.6 -r1.73.2.7
--- packages.py	5 Dec 2006 14:03:33 -0000	1.73.2.6
+++ packages.py	5 Dec 2006 14:39:34 -0000	1.73.2.7
@@ -171,7 +171,7 @@
                 return (csumtype, csum)
 
                 
-class RpmBase:
+class RpmBase(object):
     """return functions and storage for rpm-specific data"""
 
     def __init__(self):
@@ -475,7 +475,7 @@
         
         try:
             filesum = misc.checksum(csum_type, self.localPkg())
-        except Errors.MiscError, e:
+        except Errors.MiscError:
             return False
         
         if filesum != csum:
@@ -600,10 +600,11 @@
         self.summary = self.tagByName('summary')
         self.description = self.tagByName('description')
         self.pkgid = self.tagByName(rpm.RPMTAG_SHA1HEADER)
-        self.size = self.tagByName('size')
         self.__mode_cache = {}
         self.__prcoPopulated = False
-        
+
+    size = property(lambda : self.tagByName('size'))
+
     def __str__(self):
         if self.epoch == '0':
             val = '%s - %s-%s.%s' % (self.name, self.version, self.release, 

Index: pgpmsg.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/pgpmsg.py,v
retrieving revision 1.5.4.2
retrieving revision 1.5.4.3
diff -u -r1.5.4.2 -r1.5.4.3
--- pgpmsg.py	5 Dec 2006 14:03:33 -0000	1.5.4.2
+++ pgpmsg.py	5 Dec 2006 14:39:35 -0000	1.5.4.3
@@ -13,7 +13,7 @@
 ##You should have received a copy of the GNU General Public License
 ##along with this program; if not, write to the Free Software
 ##Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-import string, struct, time, cStringIO, base64, types, md5, sha
+import struct, time, cStringIO, base64, types, md5, sha
 
 debug = None
 
@@ -329,7 +329,7 @@
     return (l[1], l[2])
 
 def str_to_hex(s) :
-    return string.join(map(lambda x : string.zfill(hex(ord(x))[2:], 2), list(s)), '')
+    return ''.join(map(lambda x : hex(ord(x))[2:].zfill(2), list(s)))
 
 def duration_to_str(s) :
     if s == 0 :
@@ -353,7 +353,7 @@
             slist.append(m[i])
         else :
             slist.append('unknown(' + str(i) + ')')
-    return string.join(slist, ', ')
+    return ', '.join(slist)
 
 class pgp_packet :
     def __init__(self) :
@@ -364,7 +364,7 @@
 
 class public_key(pgp_packet) :
     def __init__(self) :
-        # just initialize the fields
+        pgp_packet.__init__(self)
         self.version = None
         self.pk_algo = None
         self.key_size = 0
@@ -478,8 +478,8 @@
 
 class user_id(pgp_packet) :
     def __init__(self) :
-        # just initialize the fields
-        id = None
+        pgp_packet.__init__(self)
+        self.id = None
 
     def deserialize(self, msg, idx, pkt_len) :
         self.id = msg[idx:idx + pkt_len]
@@ -489,7 +489,7 @@
 
 class signature(pgp_packet) :
     def __init__(self) :
-        # just initialize the fields
+        pgp_packet.__init__(self)
         self.version = None
         self.sig_type = None
         self.pk_algo = None
@@ -643,7 +643,7 @@
             return 'preferred symmetric algorithms: ' + map_to_str(algo_sk_to_str, sp[1])
         if sp[0] == SIG_SUB_TYPE_REVOKE_KEY : # revocation key
             s = 'revocation key: '
-            if sp[1] & REVOKE_KEY_CLASS_SEN :
+            if sp[1] & REVOKE_KEY_CLASS_SENS :
                 s = s + '(sensitive) '
             return s + map_to_str(algo_pk_to_str, sp[2]) + ' ' + str_to_hex(sp[3])
         if sp[0] == SIG_SUB_TYPE_ISSUER_KEY_ID : # issuer key ID
@@ -659,7 +659,7 @@
             prefs = []
             if sp[1][0] & 0x80 :
                 prefs.append('No-modify')
-            return s + string.join(prefs, ', ')
+            return s + ', '.join(prefs)
         if sp[0] == SIG_SUB_TYPE_PREF_KEY_SRVR : # preferred key server
             return 'preferred key server: %s' % sp[1]
         if sp[0] == SIG_SUB_TYPE_PRIM_USER_ID : # primary user id
@@ -686,7 +686,7 @@
                 flags.append('private component may have been secret-sharing split')
             if flgs1 & KEY_FLAGS1_GROUP :
                 flags.append('group key')
-            return 'key flags: ' + string.join(flags, ', ')
+            return 'key flags: ' + ', '.join(flags)
         if sp[0] == SIG_SUB_TYPE_SGNR_USER_ID : # signer's user id
             return 'signer id: ' + sp[1]
         if sp[0] == SIG_SUB_TYPE_REVOKE_REASON : # reason for revocation
@@ -769,7 +769,7 @@
 # a series of PGP packets of certain types in certain orders
 #
 
-class pgp_certificate :
+class pgp_certificate(object):
     def __init__(self) :
         self.version = None
         self.public_key = None
@@ -1021,9 +1021,9 @@
             plen, idx = get_whole_int(msg, idx, 4)
             return b & CTB_PKT_MASK, plen, idx
         else :
-            raise 'partial message bodies are not supported by this version (%d)', b
+            raise Exception, 'partial message bodies are not supported by this version (%d)', b
     else :
-        raise "unknown (not \"normal\") cypher type bit %d at byte %d" % (b, idx)
+        raise Exception, "unknown (not \"normal\") cypher type bit %d at byte %d" % (b, idx)
 
 def crc24(msg) :
     crc24_init = 0xb704ce
@@ -1072,7 +1072,7 @@
 def decode_msg(msg) :
     # first we'll break the block up into lines and trim each line of any 
     # carriage return chars
-    pgpkey_lines = map(lambda x : string.rstrip(x), string.split(msg, '\n'))
+    pgpkey_lines = map(lambda x : x.rstrip(), msg.split('\n'))
 
     # check out block
     in_block = 0
@@ -1104,7 +1104,7 @@
 
             # check the checksum
             if csum != crc24(cert_msg) :
-                raise 'bad checksum on pgp message'
+                raise Exception, 'bad checksum on pgp message'
 
             # ok, the sum looks ok so we'll actually decode the thing
             pkt_list = decode(cert_msg)

Index: sqlitecache.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/sqlitecache.py,v
retrieving revision 1.13.2.2
retrieving revision 1.13.2.3
diff -u -r1.13.2.2 -r1.13.2.3
--- sqlitecache.py	5 Dec 2006 14:03:33 -0000	1.13.2.2
+++ sqlitecache.py	5 Dec 2006 14:39:35 -0000	1.13.2.3
@@ -76,7 +76,6 @@
         dbchecksum = ''
         # First try to open an existing database
         try:
-            f = open(filename)
             (dbchecksum,db) = self.loadCache(filename)
         except (IOError,sqlite.DatabaseError,KeyError):
             # If it doesn't exist, create it
@@ -236,7 +235,6 @@
         # Try to create the databse in filename, or use in memory when
         # this fails
         try:
-            f = open(filename,'w')
             db = sqlite.connect(filename) 
         except IOError:
             self.verbose_logger.log(logginglevels.INFO_1, "Warning could not create sqlite cache file, using in memory cache instead")

Index: update_md.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/update_md.py,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -r1.3.2.2 -r1.3.2.3
--- update_md.py	5 Dec 2006 14:03:33 -0000	1.3.2.2
+++ update_md.py	5 Dec 2006 14:39:35 -0000	1.3.2.3
@@ -19,7 +19,6 @@
 
 import sys
 import gzip
-import string
 import exceptions
 
 from yum.yumRepo import YumRepository
@@ -213,7 +212,7 @@
 
     def get_notice(self, nvr):
         """ Retrieve an update notice for a given (name, version, release). """
-        nvr = string.join(nvr, '-')
+        nvr = '-'.join(nvr)
         return self._cache.has_key(nvr) and self._cache[nvr] or None
 
     def add(self, obj, mdtype='updateinfo'):




More information about the Yum-cvs-commits mailing list