From 5f39a832b3f3bfa24edc2d3022991645b0e2cff4 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Oct 04 2016 13:48:54 +0000
Subject: [PATCH 1/5] remove asterisk import


---

diff --git a/tests/test_tasks.py b/tests/test_tasks.py
index 92b1847..b54a01e 100644
--- a/tests/test_tasks.py
+++ b/tests/test_tasks.py
@@ -1,10 +1,13 @@
+import random
 from unittest import TestCase
 from mock import patch, mock_open, Mock, call
 from tempfile import gettempdir
 from shutil import rmtree
 from os import path, makedirs, stat, getuid, getgid
 from io import StringIO
-from koji.tasks import *
+
+import koji
+from koji.tasks import scan_mounts, umount_all, safe_rmtree, BaseTaskHandler, FakeTask, SleepTask, ForkTask
 from koji import BuildError, GenericError
 
 def get_fake_mounts_file():

From 7b954b8cd5010a997cffad13d84d7e94170b93bc Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Oct 04 2016 13:48:54 +0000
Subject: [PATCH 2/5] fixing unimported exceptions


---

diff --git a/plugins/hub/messagebus.py b/plugins/hub/messagebus.py
index 2de2d9a..981800f 100644
--- a/plugins/hub/messagebus.py
+++ b/plugins/hub/messagebus.py
@@ -4,6 +4,7 @@
 # Authors:
 #     Mike Bonnet <mikeb@redhat.com>
 
+from koji import PluginError
 from koji.plugin import callbacks, callback, ignore_error
 import ConfigParser
 import logging
@@ -29,7 +30,7 @@ def connect_timeout(host, port, timeout):
         try:
             sock.connect(sa)
             break
-        except socket.error, msg:
+        except socket.error:
             sock.close()
     else:
         # If we got here then we couldn't connect (yet)
@@ -101,7 +102,7 @@ def get_sender():
         keytab = krbV.Keytab(name='FILE:' + config.get('broker', 'keytab'), context=ctx)
         ccache.init_creds_keytab(principal=cprinc, keytab=keytab)
     else:
-        raise koji.PluginError, 'unsupported auth type: %s' % auth
+        raise PluginError, 'unsupported auth type: %s' % auth
 
     url += config.get('broker', 'host') + ':'
     url += config.get('broker', 'port')
@@ -221,7 +222,7 @@ def send_message(cbtype, *args, **kws):
         headers = get_message_headers(msgtype, *args, **kws)
         message = qpid.messaging.Message(properties=headers, content=data)
     else:
-        raise koji.PluginError, 'unsupported exchange type: %s' % exchange_type
+        raise PluginError, 'unsupported exchange type: %s' % exchange_type
 
     sender.send(message, sync=True, timeout=config.getfloat('broker', 'timeout'))
     sender.close(timeout=config.getfloat('broker', 'timeout'))

From 921258749a2be5686de2cd3d2804c627c51d2b12 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Oct 04 2016 13:48:54 +0000
Subject: [PATCH 3/5] removed unused imports


---

diff --git a/docs/source/conf.py b/docs/source/conf.py
index c3945fd..ba45283 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -12,8 +12,8 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
-import sys
-import os
+#import sys
+#import os
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
diff --git a/koji/__init__.py b/koji/__init__.py
index 2252e4f..ac108db 100644
--- a/koji/__init__.py
+++ b/koji/__init__.py
@@ -65,7 +65,6 @@ import xmlrpclib
 import xml.sax
 import xml.sax.handler
 from xmlrpclib import loads, dumps, Fault
-import zipfile
 
 PROFILE_MODULES = {}  # {module_name: module_instance}
 
diff --git a/koji/server.py b/koji/server.py
index 52f13f5..6a65017 100644
--- a/koji/server.py
+++ b/koji/server.py
@@ -19,7 +19,6 @@
 # Authors:
 #       Mike McLean <mikem@redhat.com>
 
-import koji
 import sys
 import traceback
 from koji.util import LazyDict
diff --git a/koji/ssl/SSLCommon.py b/koji/ssl/SSLCommon.py
index 345d4ea..456293b 100644
--- a/koji/ssl/SSLCommon.py
+++ b/koji/ssl/SSLCommon.py
@@ -19,7 +19,6 @@ from OpenSSL import SSL
 import SSLConnection
 import httplib
 import socket
-import SocketServer
 
 def our_verify(connection, x509, errNum, errDepth, preverifyOK):
     # print "Verify: errNum = %s, errDepth = %s, preverifyOK = %s" % (errNum, errDepth, preverifyOK)
diff --git a/koji/ssl/SSLConnection.py b/koji/ssl/SSLConnection.py
index de77d0d..d854770 100644
--- a/koji/ssl/SSLConnection.py
+++ b/koji/ssl/SSLConnection.py
@@ -6,8 +6,8 @@
 # Modifications by Dan Williams <dcbw@redhat.com>
 
 
-from OpenSSL import SSL, crypto
-import os, string, time, socket, select
+from OpenSSL import SSL
+import time, socket, select
 
 
 class SSLConnection:
diff --git a/koji/util.py b/koji/util.py
index 3fe20eb..7f0cdff 100644
--- a/koji/util.py
+++ b/koji/util.py
@@ -33,6 +33,7 @@ import time
 import ConfigParser
 from zlib import adler32
 
+# imported from kojiweb and kojihub
 try:
     from hashlib import md5 as md5_constructor
 except ImportError:
diff --git a/tests/test_hub/test_get_build_type.py b/tests/test_hub/test_get_build_type.py
index 5dc87af..00406d4 100644
--- a/tests/test_hub/test_get_build_type.py
+++ b/tests/test_hub/test_get_build_type.py
@@ -1,7 +1,6 @@
 import unittest
 import mock
 
-import koji
 import kojihub
 
 
diff --git a/tests/test_hub/test_list_btypes.py b/tests/test_hub/test_list_btypes.py
index 25a7ab4..b5f4bc5 100644
--- a/tests/test_hub/test_list_btypes.py
+++ b/tests/test_hub/test_list_btypes.py
@@ -1,7 +1,6 @@
 import unittest
 import mock
 
-import koji
 import kojihub
 
 QP = kojihub.QueryProcessor
diff --git a/tests/test_hub/test_new_typed_build.py b/tests/test_hub/test_new_typed_build.py
index 9d6516c..f2287d3 100644
--- a/tests/test_hub/test_new_typed_build.py
+++ b/tests/test_hub/test_new_typed_build.py
@@ -1,7 +1,6 @@
 import unittest
 import mock
 
-import koji
 import kojihub
 
 
diff --git a/tests/test_hub/test_recycle_build.py b/tests/test_hub/test_recycle_build.py
index 24d61bb..2179b04 100644
--- a/tests/test_hub/test_recycle_build.py
+++ b/tests/test_hub/test_recycle_build.py
@@ -1,4 +1,3 @@
-import unittest
 import mock
 
 import koji
diff --git a/tests/test_tasks.py b/tests/test_tasks.py
index b54a01e..c62af25 100644
--- a/tests/test_tasks.py
+++ b/tests/test_tasks.py
@@ -1,9 +1,9 @@
 import random
 from unittest import TestCase
-from mock import patch, mock_open, Mock, call
+from mock import patch, Mock, call
 from tempfile import gettempdir
 from shutil import rmtree
-from os import path, makedirs, stat, getuid, getgid
+from os import path, makedirs
 from io import StringIO
 
 import koji
diff --git a/vm/kojikamid.py b/vm/kojikamid.py
index 15c0570..dd097f9 100755
--- a/vm/kojikamid.py
+++ b/vm/kojikamid.py
@@ -33,7 +33,6 @@ import subprocess
 import sys
 import tempfile
 import time
-import urlparse
 import xmlrpclib
 import base64
 import hashlib
diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py
index 63c6be6..871ac9b 100644
--- a/www/kojiweb/index.py
+++ b/www/kojiweb/index.py
@@ -26,8 +26,6 @@ import re
 import sys
 import mimetypes
 import Cookie
-import Cheetah.Filters
-import Cheetah.Template
 import datetime
 import logging
 import time
diff --git a/www/lib/kojiweb/util.py b/www/lib/kojiweb/util.py
index 5f065a5..5aa1cb3 100644
--- a/www/lib/kojiweb/util.py
+++ b/www/lib/kojiweb/util.py
@@ -26,7 +26,6 @@ import koji
 from koji.util import md5_constructor
 import os
 import stat
-import time
 #a bunch of exception classes that explainError needs
 from socket import error as socket_error
 from socket import sslerror as socket_sslerror

From c37effcbd72b242bff98515f097eaab2e5964a04 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Oct 04 2016 13:48:54 +0000
Subject: [PATCH 4/5] remove unused variables/methods


---

diff --git a/koji/__init__.py b/koji/__init__.py
index ac108db..81ab53b 100644
--- a/koji/__init__.py
+++ b/koji/__init__.py
@@ -2099,7 +2099,6 @@ class ClientSession(object):
             handler, headers, request = self._prepCall(name, args, kwargs)
             tries = 0
             self.retries = 0
-            debug = self.opts.get('debug', False)
             max_retries = self.opts.get('max_retries', 30)
             interval = self.opts.get('retry_interval', 20)
             while True:
@@ -2279,7 +2278,7 @@ class ClientSession(object):
 
         # check if server supports fast upload
         try:
-            check = self._callMethod('checkUpload', (path, name))
+            self._callMethod('checkUpload', (path, name))
             # fast upload was introduced in 1.7.1, earlier servers will not
             # recognise this call and return an error
         except GenericError:
@@ -2517,7 +2516,7 @@ def _taskLabel(taskInfo):
                 extra = build_target['name']
     elif method == 'winbuild':
         if taskInfo.has_key('request'):
-            vm = taskInfo['request'][0]
+            #vm = taskInfo['request'][0]
             url = taskInfo['request'][1]
             target = taskInfo['request'][2]
             module_info = _module_info(url)
@@ -2607,7 +2606,7 @@ def fixEncoding(value, fallback='iso8859-15'):
         # decode it using the fallback encoding.
         try:
             return value.decode('utf8').encode('utf8')
-        except UnicodeDecodeError, err:
+        except UnicodeDecodeError:
             return value.decode(fallback).encode('utf8')
 
 def add_file_logger(logger, fn):
diff --git a/koji/daemon.py b/koji/daemon.py
index 7e057ce..5c38814 100644
--- a/koji/daemon.py
+++ b/koji/daemon.py
@@ -912,7 +912,7 @@ class TaskManager(object):
                 return None
 
             return procstats
-        except IOError, e:
+        except IOError:
             # process may have already gone away
             return None
 
@@ -1103,7 +1103,6 @@ class TaskManager(object):
             self.logger.warn("Could not open")
             return False
         task_id = data['id']
-        request = data['request']
         self.tasks[task_id] = data
         # set weight
         try:
diff --git a/koji/ssl/SSLCommon.py b/koji/ssl/SSLCommon.py
index 456293b..fa5e64a 100644
--- a/koji/ssl/SSLCommon.py
+++ b/koji/ssl/SSLCommon.py
@@ -105,7 +105,7 @@ class PlgHTTPSConnection(httplib.HTTPConnection):
                 self.sock.connect(sa)
                 if self.debuglevel > 0:
                     print "connect: (%s, %s) [ssl]" % (self.host, self.port)
-            except socket.error, msg:
+            except socket.error:
                 if self.debuglevel > 0:
                     print 'connect fail:', (self.host, self.port)
                 if self.sock:
diff --git a/koji/tasks.py b/koji/tasks.py
index 4567eed..b8454eb 100644
--- a/koji/tasks.py
+++ b/koji/tasks.py
@@ -222,7 +222,7 @@ class BaseTaskHandler(object):
                         failed = False
                         for task in finished:
                             try:
-                                result = self.session.getTaskResult(task)
+                                self.session.getTaskResult(task)
                             except (koji.GenericError, xmlrpclib.Fault), task_error:
                                 self.logger.info("task %s failed or was canceled" % task)
                                 failed = True
diff --git a/koji/util.py b/koji/util.py
index 7f0cdff..9ded6c4 100644
--- a/koji/util.py
+++ b/koji/util.py
@@ -624,7 +624,7 @@ def parse_maven_chain(confs, scratch=False):
     for package, params in builds.items():
         depmap[package] = set(params.get('buildrequires', []))
     try:
-        order = tsort(depmap)
-    except ValueError, e:
+        tsort(depmap)
+    except ValueError:
         raise ValueError, 'No possible build order, missing/circular dependencies'
     return builds
diff --git a/tests/test_hub/test_delete_build.py b/tests/test_hub/test_delete_build.py
index d6fc103..2cd2dae 100644
--- a/tests/test_hub/test_delete_build.py
+++ b/tests/test_hub/test_delete_build.py
@@ -39,22 +39,6 @@ class TestDeleteBuild(unittest.TestCase):
                 refs.return_value = retval
                 assert kojihub.delete_build(build='', strict=False) is False
 
-    @mock.patch('kojihub.context')
-    @mock.patch('kojihub.get_build')
-    def test_delete_build_check_last_used_raise_error(self, build, context):
-        context.session.assertPerm = mock.MagicMock()
-        references = ['tags', 'rpms', 'archives', 'images', 'last_used']
-        for ref in references:
-            context = mock.MagicMock()
-            context.session.return_value = context
-
-            with mock.patch('kojihub.build_references') as refs:
-                retval = defaultdict(dict)
-                if ref == 'last_used':
-                    retval[ref] = time.time()+100
-                    refs.return_value = retval
-                    with self.assertRaises(GenericError):
-                        kojihub.delete_build(build='', strict=True)
 
     @mock.patch('kojihub.context')
     @mock.patch('kojihub.get_build')
@@ -70,4 +54,4 @@ class TestDeleteBuild(unittest.TestCase):
                 if ref == 'last_used':
                     retval[ref] = time.time()+100
                     refs.return_value = retval
-                    assert kojihub.delete_build(build='', strict=False) is False
+                    self.assertFalse(kojihub.delete_build(build='', strict=False))
diff --git a/tests/test_hub/test_get_build_type.py b/tests/test_hub/test_get_build_type.py
index 00406d4..b4013e9 100644
--- a/tests/test_hub/test_get_build_type.py
+++ b/tests/test_hub/test_get_build_type.py
@@ -9,7 +9,6 @@ class TestGetBuildType(unittest.TestCase):
     @mock.patch('kojihub.get_build')
     @mock.patch('kojihub.QueryProcessor')
     def test_no_build(self, QueryProcessor, get_build):
-        mocks = [QueryProcessor, get_build]
         get_build.return_value = None
 
         # strict on
@@ -25,8 +24,6 @@ class TestGetBuildType(unittest.TestCase):
     @mock.patch('kojihub.QueryProcessor')
     def test_has_build(self, QueryProcessor, get_build, get_image_build,
                 get_win_build, get_maven_build):
-        mocks = [x for x in locals().values() if x is not self]
-
         typeinfo = {'maven': {'maven': 'foo'},
                     'win': {'win': 'foo'},
                     'image': {'image': 'foo'},
diff --git a/tests/test_hub/test_new_typed_build.py b/tests/test_hub/test_new_typed_build.py
index f2287d3..a1ae47f 100644
--- a/tests/test_hub/test_new_typed_build.py
+++ b/tests/test_hub/test_new_typed_build.py
@@ -13,8 +13,7 @@ class TestNewTypedBuild(unittest.TestCase):
 
         binfo = {'id': 1, 'foo': '137'}
         btype = 'sometype'
-        btype_id = 99
-        lookup_name.return_value = {'id':99, 'name':btype}
+        lookup_name.return_value = {'id': 99, 'name': btype}
 
         # no current entry
         query = QueryProcessor.return_value

From 36f5be2b3f5308edf84ab477f377057eb54b2e24 Mon Sep 17 00:00:00 2001
From: Tomas Kopecek <tkopecek@redhat.com>
Date: Oct 04 2016 14:12:52 +0000
Subject: [PATCH 5/5] unused returns (handled by env)


---

diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py
index 871ac9b..d49070d 100644
--- a/www/kojiweb/index.py
+++ b/www/kojiweb/index.py
@@ -293,8 +293,8 @@ def index(environ, packageOrder='package_name', packageStart=None):
     values['order'] = '-id'
 
     if user:
-        packages = kojiweb.util.paginateResults(server, values, 'listPackages', kw={'userID': user['id'], 'with_dups': True},
-                                                start=packageStart, dataName='packages', prefix='package', order=packageOrder, pageSize=10)
+        kojiweb.util.paginateResults(server, values, 'listPackages', kw={'userID': user['id'], 'with_dups': True},
+                                     start=packageStart, dataName='packages', prefix='package', order=packageOrder, pageSize=10)
 
         notifs = server.getBuildNotifications(user['id'])
         notifs.sort(kojiweb.util.sortByKeyFunc('id'))
@@ -790,8 +790,8 @@ def tags(environ, start=None, order=None, childID=None):
         order = 'name'
     values['order'] = order
 
-    tags = kojiweb.util.paginateMethod(server, values, 'listTags', kw=None,
-                                       start=start, dataName='tags', prefix='tag', order=order)
+    kojiweb.util.paginateMethod(server, values, 'listTags', kw=None,
+                                 start=start, dataName='tags', prefix='tag', order=order)
 
     if environ['koji.currentUser']:
         values['perms'] = server.getUserPerms(environ['koji.currentUser']['id'])
@@ -830,9 +830,9 @@ def packages(environ, tagID=None, userID=None, order='package_name', start=None,
     inherited = int(inherited)
     values['inherited'] = inherited
 
-    packages = kojiweb.util.paginateResults(server, values, 'listPackages',
-                                            kw={'tagID': tagID, 'userID': userID, 'prefix': prefix, 'inherited': bool(inherited)},
-                                            start=start, dataName='packages', prefix='package', order=order)
+    kojiweb.util.paginateResults(server, values, 'listPackages',
+                                 kw={'tagID': tagID, 'userID': userID, 'prefix': prefix, 'inherited': bool(inherited)},
+                                 start=start, dataName='packages', prefix='package', order=order)
 
     values['chars'] = _PREFIX_CHARS
 
@@ -853,10 +853,10 @@ def packageinfo(environ, packageID, tagOrder='name', tagStart=None, buildOrder='
     values['package'] = package
     values['packageID'] = package['id']
 
-    tags = kojiweb.util.paginateMethod(server, values, 'listTags', kw={'package': package['id']},
-                                       start=tagStart, dataName='tags', prefix='tag', order=tagOrder)
-    builds = kojiweb.util.paginateMethod(server, values, 'listBuilds', kw={'packageID': package['id']},
-                                         start=buildStart, dataName='builds', prefix='build', order=buildOrder)
+    kojiweb.util.paginateMethod(server, values, 'listTags', kw={'package': package['id']},
+                                start=tagStart, dataName='tags', prefix='tag', order=tagOrder)
+    kojiweb.util.paginateMethod(server, values, 'listBuilds', kw={'packageID': package['id']},
+                                start=buildStart, dataName='builds', prefix='build', order=buildOrder)
 
     return _genHTML(environ, 'packageinfo.chtml')
 
@@ -1285,16 +1285,16 @@ def builds(environ, userID=None, tagID=None, packageID=None, state=None, order='
 
     if tag:
         # don't need to consider 'state' here, since only completed builds would be tagged
-        builds = kojiweb.util.paginateResults(server, values, 'listTagged', kw={'tag': tag['id'], 'package': (package and package['name'] or None),
-                                                                                'owner': (user and user['name'] or None),
-                                                                                'type': type,
-                                                                                'inherit': bool(inherited), 'latest': bool(latest), 'prefix': prefix},
-                                              start=start, dataName='builds', prefix='build', order=order)
+        kojiweb.util.paginateResults(server, values, 'listTagged', kw={'tag': tag['id'], 'package': (package and package['name'] or None),
+                                                                       'owner': (user and user['name'] or None),
+                                                                       'type': type,
+                                                                       'inherit': bool(inherited), 'latest': bool(latest), 'prefix': prefix},
+                                     start=start, dataName='builds', prefix='build', order=order)
     else:
-        builds = kojiweb.util.paginateMethod(server, values, 'listBuilds', kw={'userID': (user and user['id'] or None), 'packageID': (package and package['id'] or None),
-                                                                               'type': type,
-                                                                               'state': state, 'prefix': prefix},
-                                             start=start, dataName='builds', prefix='build', order=order)
+        kojiweb.util.paginateMethod(server, values, 'listBuilds', kw={'userID': (user and user['id'] or None), 'packageID': (package and package['id'] or None),
+                                                                      'type': type,
+                                                                      'state': state, 'prefix': prefix},
+                                    start=start, dataName='builds', prefix='build', order=order)
 
     values['chars'] = _PREFIX_CHARS
 
@@ -1312,8 +1312,8 @@ def users(environ, order='name', start=None, prefix=None):
 
     values['order'] = order
 
-    users = kojiweb.util.paginateMethod(server, values, 'listUsers', kw={'prefix': prefix},
-                                        start=start, dataName='users', prefix='user', order=order)
+    kojiweb.util.paginateMethod(server, values, 'listUsers', kw={'prefix': prefix},
+                                start=start, dataName='users', prefix='user', order=order)
 
     values['chars'] = _PREFIX_CHARS
 
@@ -1333,11 +1333,11 @@ def userinfo(environ, userID, packageOrder='package_name', packageStart=None, bu
     values['userID'] = userID
     values['taskCount'] = server.listTasks(opts={'owner': user['id'], 'parent': None}, queryOpts={'countOnly': True})
 
-    packages = kojiweb.util.paginateResults(server, values, 'listPackages', kw={'userID': user['id'], 'with_dups': True},
-                                            start=packageStart, dataName='packages', prefix='package', order=packageOrder, pageSize=10)
+    kojiweb.util.paginateResults(server, values, 'listPackages', kw={'userID': user['id'], 'with_dups': True},
+                                 start=packageStart, dataName='packages', prefix='package', order=packageOrder, pageSize=10)
 
-    builds = kojiweb.util.paginateMethod(server, values, 'listBuilds', kw={'userID': user['id']},
-                                         start=buildStart, dataName='builds', prefix='build', order=buildOrder, pageSize=10)
+    kojiweb.util.paginateMethod(server, values, 'listBuilds', kw={'userID': user['id']},
+                                start=buildStart, dataName='builds', prefix='build', order=buildOrder, pageSize=10)
 
     return _genHTML(environ, 'userinfo.chtml')
 
@@ -1382,8 +1382,8 @@ def rpminfo(environ, rpmID, fileOrder='name', fileStart=None, buildrootOrder='-i
     values['builtInRoot'] = builtInRoot
     values['buildroots'] = buildroots
 
-    files = kojiweb.util.paginateMethod(server, values, 'listRPMFiles', args=[rpm['id']],
-                                        start=fileStart, dataName='files', prefix='file', order=fileOrder)
+    kojiweb.util.paginateMethod(server, values, 'listRPMFiles', args=[rpm['id']],
+                                start=fileStart, dataName='files', prefix='file', order=fileOrder)
 
     return _genHTML(environ, 'rpminfo.chtml')
 
@@ -1404,8 +1404,8 @@ def archiveinfo(environ, archiveID, fileOrder='name', fileStart=None, buildrootO
     builtInRoot = None
     if archive['buildroot_id'] != None:
         builtInRoot = server.getBuildroot(archive['buildroot_id'])
-    files = kojiweb.util.paginateMethod(server, values, 'listArchiveFiles', args=[archive['id']],
-                                        start=fileStart, dataName='files', prefix='file', order=fileOrder)
+    kojiweb.util.paginateMethod(server, values, 'listArchiveFiles', args=[archive['id']],
+                                start=fileStart, dataName='files', prefix='file', order=fileOrder)
     buildroots = kojiweb.util.paginateMethod(server, values, 'listBuildroots', kw={'archiveID': archive['id']},
                                              start=buildrootStart, dataName='buildroots', prefix='buildroot',
                                              order=buildrootOrder)
@@ -1675,15 +1675,16 @@ def rpmlist(environ, type, buildrootID=None, imageID=None, start=None, order='nv
         if buildroot == None:
             raise koji.GenericError, 'unknown buildroot ID: %i' % buildrootID
 
-        rpms = None
         if type == 'component':
-            rpms = kojiweb.util.paginateMethod(server, values, 'listRPMs',
-                   kw={'componentBuildrootID': buildroot['id']},
-                   start=start, dataName='rpms', prefix='rpm', order=order)
+            kojiweb.util.paginateMethod(server, values, 'listRPMs',
+                                        kw={'componentBuildrootID': buildroot['id']},
+                                        start=start, dataName='rpms',
+                                        prefix='rpm', order=order)
         elif type == 'built':
-            rpms = kojiweb.util.paginateMethod(server, values, 'listRPMs',
-                   kw={'buildrootID': buildroot['id']},
-                   start=start, dataName='rpms', prefix='rpm', order=order)
+            kojiweb.util.paginateMethod(server, values, 'listRPMs',
+                                        kw={'buildrootID': buildroot['id']},
+                                        start=start, dataName='rpms',
+                                        prefix='rpm', order=order)
         else:
             raise koji.GenericError, 'unrecognized type of rpmlist'
 
@@ -1692,9 +1693,10 @@ def rpmlist(environ, type, buildrootID=None, imageID=None, start=None, order='nv
         values['image'] = server.getArchive(imageID)
         # If/When future image types are supported, add elifs here if needed.
         if type == 'image':
-            rpms =  kojiweb.util.paginateMethod(server, values, 'listRPMs',
-                    kw={'imageID': imageID}, \
-                    start=start, dataName='rpms', prefix='rpm', order=order)
+            kojiweb.util.paginateMethod(server, values, 'listRPMs',
+                                        kw={'imageID': imageID}, \
+                                        start=start, dataName='rpms',
+                                        prefix='rpm', order=order)
         else:
             raise koji.GenericError, 'unrecognized type of image rpmlist'
 
@@ -1716,13 +1718,12 @@ def archivelist(environ, buildrootID, type, start=None, order='filename'):
     if buildroot == None:
         raise koji.GenericError, 'unknown buildroot ID: %i' % buildrootID
 
-    archives = None
     if type == 'component':
-        rpms = kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'componentBuildrootID': buildroot['id']},
-                                           start=start, dataName='archives', prefix='archive', order=order)
+        kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'componentBuildrootID': buildroot['id']},
+                                    start=start, dataName='archives', prefix='archive', order=order)
     elif type == 'built':
-        rpms = kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'buildrootID': buildroot['id']},
-                                           start=start, dataName='archives', prefix='archive', order=order)
+        kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'buildrootID': buildroot['id']},
+                                    start=start, dataName='archives', prefix='archive', order=order)
     else:
         raise koji.GenericError, 'invalid type: %s' % type
 
@@ -1737,8 +1738,8 @@ def buildtargets(environ, start=None, order='name'):
     values = _initValues(environ, 'Build Targets', 'buildtargets')
     server = _getServer(environ)
 
-    targets = kojiweb.util.paginateMethod(server, values, 'getBuildTargets',
-                                          start=start, dataName='targets', prefix='target', order=order)
+    kojiweb.util.paginateMethod(server, values, 'getBuildTargets',
+                                start=start, dataName='targets', prefix='target', order=order)
 
     values['order'] = order
     if environ['koji.currentUser']:
@@ -1865,8 +1866,8 @@ def buildtargetdelete(environ, targetID):
     _redirect(environ, 'buildtargets')
 
 def reports(environ):
-    server = _getServer(environ)
-    values = _initValues(environ, 'Reports', 'reports')
+    _getServer(environ)
+    _initValues(environ, 'Reports', 'reports')
     return _genHTML(environ, 'reports.chtml')
 
 def buildsbyuser(environ, start=None, order='-builds'):

