1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-23 22:58:53 +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

@@ -4135,7 +4135,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not pac.todo:
pac.todo = pac.filenamelist + pac.filenamelist_unvers
pac.todo.sort()
for prj_path, packages in prj_paths.iteritems():
for prj_path, packages in prj_paths.items():
prj = Project(prj_path)
if not msg:
msg = get_commit_msg(prj.absdir, pac_objs[prj_path])
@@ -6490,7 +6490,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if role_filter:
role_filter = '%s (%s)' % (search_term, role_filter)
kind_map = {'published/binary/id': 'binary'}
for kind, root in res.iteritems():
for kind, root in res.items():
results = []
for node in root.findall(kind_map.get(kind, kind)):
result = []
@@ -7791,7 +7791,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
args = parseargs(args)
pacs = []
apiurls = conf.config['api_host_options'].keys()
apiurls = list(conf.config['api_host_options'].keys())
apiurl = ''
for i in args:
if is_project_dir(i):