1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-06 05:08:42 +02:00

python3 compatibility: dict

this patch
 1.) removes the iteritems/itervalues, which were dropped in py3
     items/values are used instead
 2.) add an extra list() in a cases the list-based access is needed
     (included appending, indexing and so)
 3.) changes a sorting idiom in few places
     instead of
     foo = dict.keys()
     foo.sort()
     for i in foo:

     there is a recommended

     for i in sorted(dict.keys()):
 4.) in one occassion it removes a if dict.has_key() by simpler
   dict.get(key, default)
This commit is contained in:
Michal Vyskocil
2013-04-09 11:25:19 +02:00
committed by Adrian Schröter
parent c5a235ed78
commit d3648be24b
6 changed files with 22 additions and 30 deletions

View File

@@ -62,7 +62,7 @@ class CpioHdr:
self.namesize = namesize
# != 0 indicates CRC format (which we do not support atm)
self.checksum = checksum
for k,v in self.__dict__.iteritems():
for k,v in self.__dict__.items():
self.__dict__[k] = int(v, 16)
self.filename = filename
# data starts at dataoff and ends at dataoff+filesize