diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2024-01-18 19:09:58 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-01-18 19:09:58 +0100 |
commit | cc7362d28bd9c43cb6839809f86e59874f2fe458 (patch) | |
tree | 1053748f5890c769d1e99806bc0c8bcffca6f0fe /libbe/command/show.py | |
parent | 003bd13629d9db2f14156f97b74a4672e9ecdf77 (diff) | |
download | bugseverywhere-cc7362d28bd9c43cb6839809f86e59874f2fe458.tar.gz |
2to3 conversion of the repo.
Diffstat (limited to 'libbe/command/show.py')
-rw-r--r-- | libbe/command/show.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libbe/command/show.py b/libbe/command/show.py index 3b61cc5..c08fd1f 100644 --- a/libbe/command/show.py +++ b/libbe/command/show.py @@ -112,10 +112,9 @@ class Show (libbe.command.Command): % params['id'][0]) sys.__stdout__.write(comment.body) return 0 - print >> self.stdout, \ - output(bugdirs, params['id'], encoding=self.stdout.encoding, + print(output(bugdirs, params['id'], encoding=self.stdout.encoding, as_xml=params['xml'], - with_comments=not params['no-comments']) + with_comments=not params['no-comments']), file=self.stdout) return 0 def _long_help(self): @@ -147,7 +146,7 @@ def _sort_ids(bugdirs, ids, with_comments=True): root_comments[p['bug']] = [p['comment']] else: root_comments[p['bug']].append(p['comment']) - for bugname in root_comments.keys(): + for bugname in list(root_comments.keys()): assert bugname not in bugs, \ 'specifically requested both #/%s/%s# and #/%s#' \ % (bugname, root_comments[bugname][0], bugname) @@ -169,7 +168,7 @@ def _xml_footer(): def output(bugdirs, ids, encoding, as_xml=True, with_comments=True): if ids == None or len(ids) == 0: ids = [] - for bugdir in bugdirs.values(): + for bugdir in list(bugdirs.values()): bugdir.load_all_bugs() ids.extend([bug.id.user() for bug in bugdir]) uuids,root_comments = _sort_ids(bugdirs, ids, with_comments) @@ -187,14 +186,14 @@ def output(bugdirs, ids, encoding, as_xml=True, with_comments=True): if spaces_left > 0: spaces_left -= 1 lines.append('') # add a blank line between bugs/comments - for bugname,comments in root_comments.items(): + for bugname,comments in list(root_comments.items()): bug = libbe.command.util.bug_from_uuid(bugdirs, bugname) if as_xml: lines.extend([' <bug>', ' <uuid>%s</uuid>' % bug.uuid]) for commname in comments: try: comment = bug.comment_root.comment_from_uuid(commname) - except KeyError, e: + except KeyError as e: raise libbe.command.UserError(e.message) if as_xml: lines.append(comment.xml(indent=4)) |