From d706d694854e2b675876367f17aeb40a215e6a38 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Oct 01 2020 13:48:57 +0000
Subject: to_list is not needed in py3 code


Fixes: https://pagure.io/koji/issue/2514

---

diff --git a/hub/kojihub.py b/hub/kojihub.py
index aa18a8d..1734459 100644
--- a/hub/kojihub.py
+++ b/hub/kojihub.py
@@ -68,7 +68,6 @@ from koji.util import (
     move_and_symlink,
     multi_fnmatch,
     safer_move,
-    to_list
 )
 
 try:
@@ -2189,18 +2188,18 @@ def readTagGroups(tag, event=None, inherit=True, incl_pkgs=True, incl_reqs=True,
     Blocked packages/groups can alternatively also be listed if incl_blocked is set to True
     """
     groups = get_tag_groups(tag, event, inherit, incl_pkgs, incl_reqs)
-    groups = to_list(groups.values())
+    groups = list(groups.values())
     for group in groups:
         # filter blocked entries and collapse to a list
         if 'packagelist' in group:
             if incl_blocked:
-                group['packagelist'] = to_list(group['packagelist'].values())
+                group['packagelist'] = list(group['packagelist'].values())
             else:
                 group['packagelist'] = [x for x in group['packagelist'].values()
                                         if not x['blocked']]
         if 'grouplist' in group:
             if incl_blocked:
-                group['grouplist'] = to_list(group['grouplist'].values())
+                group['grouplist'] = list(group['grouplist'].values())
             else:
                 group['grouplist'] = [x for x in group['grouplist'].values()
                                       if not x['blocked']]
@@ -2366,7 +2365,7 @@ def get_all_arches():
             # in a perfect world, this list would only include canonical
             # arches, but not all admins will undertand that.
             ret[koji.canonArch(arch)] = 1
-    return to_list(ret.keys())
+    return list(ret.keys())
 
 
 def get_active_tasks(host=None):
@@ -5922,7 +5921,7 @@ def import_build(srpm, rpms, brmap=None, task_id=None, build_id=None, logs=None)
         'package': build['name'],
         'version': build['version'],
         'release': build['release'],
-        'buildroots': to_list(brmap.values()),
+        'buildroots': list(brmap.values()),
         'import': True,
         'import_type': 'rpm',
     }
@@ -7927,7 +7926,7 @@ def build_references(build_id, limit=None, lazy=False):
             idx.setdefault(row['id'], row)
         if limit is not None and len(idx) > limit:
             break
-    ret['rpms'] = to_list(idx.values())
+    ret['rpms'] = list(idx.values())
 
     if lazy and ret['rpms']:
         return ret
@@ -7971,7 +7970,7 @@ def build_references(build_id, limit=None, lazy=False):
             idx.setdefault(row['id'], row)
         if limit is not None and len(idx) > limit:
             break
-    ret['archives'] = to_list(idx.values())
+    ret['archives'] = list(idx.values())
 
     if lazy and ret['archives']:
         return ret
@@ -8383,7 +8382,7 @@ def tag_notification(is_successful, tag_id, from_id, build_id, user_id, ignore_s
         if from_tag:
             for email in get_notification_recipients(build, from_tag['id'], state):
                 recipients[email] = 1
-    recipients_uniq = to_list(recipients.keys())
+    recipients_uniq = list(recipients.keys())
     if len(recipients_uniq) > 0 and not (is_successful and ignore_success):
         task_id = make_task('tagNotification',
                             [recipients_uniq, is_successful, tag_id, from_id, build_id, user_id,
@@ -8779,7 +8778,7 @@ class InsertProcessor(object):
         if not self.data and not self.rawdata:
             return "-- incomplete update: no assigns"
         parts = ['INSERT INTO %s ' % self.table]
-        columns = sorted(to_list(self.data.keys()) + to_list(self.rawdata.keys()))
+        columns = sorted(list(self.data.keys()) + list(self.rawdata.keys()))
         parts.append("(%s) " % ', '.join(columns))
         values = []
         for key in columns:
@@ -8822,7 +8821,7 @@ class InsertProcessor(object):
             del data['create_event']
             del data['creator_id']
         clauses = ["%s = %%(%s)s" % (k, k) for k in data]
-        query = QueryProcessor(columns=to_list(data.keys()), tables=[self.table],
+        query = QueryProcessor(columns=list(data.keys()), tables=[self.table],
                                clauses=clauses, values=data)
         if query.execute():
             return True
@@ -11465,7 +11464,7 @@ class RootExports(object):
             # lookup tag id
             tag = get_tag_id(tag, strict=True)
         for mapping in [stops, jumps]:
-            for key in to_list(mapping.keys()):
+            for key in mapping.keys():
                 mapping[int(key)] = mapping[key]
         return readFullInheritance(tag, event, reverse, stops, jumps)
 
@@ -13689,7 +13688,7 @@ class HostExports(object):
         scratchdir = koji.pathinfo.scratch()
         username = get_user(task.getOwner())['name']
         destdir = joinpath(scratchdir, username, 'task_%s' % task_id)
-        for reldir, files in to_list(results['files'].items()) + [('', results['logs'])]:
+        for reldir, files in list(results['files'].items()) + [('', results['logs'])]:
             for filename in files:
                 if reldir:
                     relpath = joinpath(reldir, filename)
@@ -13717,7 +13716,7 @@ class HostExports(object):
         scratchdir = koji.pathinfo.scratch()
         username = get_user(task.getOwner())['name']
         destdir = joinpath(scratchdir, username, 'task_%s' % task_id)
-        for relpath in to_list(results['output'].keys()) + results['logs']:
+        for relpath in list(results['output'].keys()) + results['logs']:
             filename = joinpath(koji.pathinfo.task(results['task_id']), relpath)
             dest = joinpath(destdir, relpath)
             move_and_symlink(filename, dest, create_dir=True)
@@ -14435,7 +14434,7 @@ class HostExports(object):
                             build = get_build(build_id)
                             logger.error("g:a:v supplied by build %(nvr)s", build)
                             logger.error("Build supplies %i archives: %r",
-                                         len(build_archives), to_list(build_archives.keys()))
+                                         len(build_archives), list(build_archives.keys()))
                         if tag_archive:
                             logger.error("Size mismatch, br: %i, db: %i",
                                          fileinfo['size'], tag_archive['size'])
diff --git a/hub/kojixmlrpc.py b/hub/kojixmlrpc.py
index 8359051..5578a65 100644
--- a/hub/kojixmlrpc.py
+++ b/hub/kojixmlrpc.py
@@ -155,7 +155,7 @@ class HandlerRegistry(object):
         return args
 
     def system_listMethods(self):
-        return koji.util.to_list(self.funcs.keys())
+        return list(self.funcs.keys())
 
     def system_methodSignature(self, method):
         # it is not possible to autogenerate this data
diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py
index 00fafd3..e3c6080 100644
--- a/www/kojiweb/index.py
+++ b/www/kojiweb/index.py
@@ -34,7 +34,6 @@ import time
 import koji
 import kojiweb.util
 from koji.server import ServerRedirect
-from koji.util import to_list
 from kojiweb.util import _genHTML, _getValidTokens, _initValues
 
 
@@ -2257,7 +2256,7 @@ def buildsbytarget(environ, days='7', start=None, order='-builds'):
         if builds > maxBuilds:
             maxBuilds = builds
 
-    kojiweb.util.paginateList(values, to_list(targets.values()), start, 'targets', 'target', order)
+    kojiweb.util.paginateList(values, list(targets.values()), start, 'targets', 'target', order)
 
     values['order'] = order
 
diff --git a/www/kojiweb/wsgi_publisher.py b/www/kojiweb/wsgi_publisher.py
index 9ed48f2..3bc8eb8 100644
--- a/www/kojiweb/wsgi_publisher.py
+++ b/www/kojiweb/wsgi_publisher.py
@@ -30,7 +30,7 @@ import traceback
 import koji
 import koji.util
 from koji.server import ServerError, ServerRedirect
-from koji.util import dslice, to_list
+from koji.util import dslice
 
 
 class URLNotFound(ServerError):
@@ -402,7 +402,7 @@ class Dispatcher(object):
         if isinstance(result, str):
             headers.setdefault('content-length', ('Content-Length', str(len(result))))
         headers.setdefault('content-type', ('Content-Type', 'text/html'))
-        headers = to_list(headers.values()) + extra
+        headers = list(headers.values()) + extra
         self.logger.debug("Headers:")
         self.logger.debug(koji.util.LazyString(pprint.pformat, [headers]))
         start_response(status, headers)

