changeset 4423:395be5fa6eef

cleanup: remove unused variables, found with pyflakes
author Mads Kiilerich <madski@unity3d.com>
date Tue, 12 Aug 2014 13:08:23 +0200
parents d51a6f5e57d1
children fc7eed9ebe60
files kallithea/bin/rebranddb.py kallithea/controllers/admin/my_account.py kallithea/controllers/admin/repo_groups.py kallithea/controllers/admin/users.py kallithea/controllers/files.py kallithea/controllers/pullrequests.py kallithea/lib/celerylib/tasks.py kallithea/lib/vcs/backends/git/changeset.py kallithea/lib/vcs/backends/git/repository.py kallithea/lib/vcs/backends/hg/repository.py kallithea/model/repo.py
diffstat 11 files changed, 11 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/bin/rebranddb.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/bin/rebranddb.py	Tue Aug 12 13:08:23 2014 +0200
@@ -160,7 +160,6 @@
         print '  where DBSTRING is the value of sqlalchemy.db1.url from the .ini,'
         print '  NEW defaults to "kallithea", OLD is by default detected from the db"'
         raise SystemExit(0)
-    db = argv[1]
     new = 'kallithea'
     if len(argv) > 2:
         new = argv[2]
--- a/kallithea/controllers/admin/my_account.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/controllers/admin/my_account.py	Tue Aug 12 13:08:23 2014 +0200
@@ -248,8 +248,7 @@
     def my_account_api_keys_add(self):
         lifetime = safe_int(request.POST.get('lifetime'), -1)
         description = request.POST.get('description')
-        new_api_key = ApiKeyModel().create(self.authuser.user_id,
-                                           description, lifetime)
+        ApiKeyModel().create(self.authuser.user_id, description, lifetime)
         Session().commit()
         h.flash(_("Api key successfully created"), category='success')
         return redirect(url('my_account_api_keys'))
--- a/kallithea/controllers/admin/repo_groups.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/controllers/admin/repo_groups.py	Tue Aug 12 13:08:23 2014 +0200
@@ -331,7 +331,6 @@
         c.group_repos = c.group.repositories.all()
 
         #overwrite our cached list with current filter
-        gr_filter = c.group_repos
         c.repo_cnt = 0
 
         groups = RepoGroup.query().order_by(RepoGroup.group_name)\
--- a/kallithea/controllers/admin/users.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/controllers/admin/users.py	Tue Aug 12 13:08:23 2014 +0200
@@ -310,7 +310,7 @@
 
         lifetime = safe_int(request.POST.get('lifetime'), -1)
         description = request.POST.get('description')
-        new_api_key = ApiKeyModel().create(c.user.user_id, description, lifetime)
+        ApiKeyModel().create(c.user.user_id, description, lifetime)
         Session().commit()
         h.flash(_("Api key successfully created"), category='success')
         return redirect(url('edit_user_api_keys', id=c.user.user_id))
--- a/kallithea/controllers/files.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/controllers/files.py	Tue Aug 12 13:08:23 2014 +0200
@@ -132,7 +132,7 @@
         # redirect to given revision from form if given
         post_revision = request.POST.get('at_rev', None)
         if post_revision:
-            cs = self.__get_cs(post_revision)
+            cs = self.__get_cs(post_revision) # FIXME - unused!
 
         c.revision = revision
         c.changeset = self.__get_cs(revision)
@@ -772,9 +772,8 @@
         changesets_group = ([], _("Changesets"))
         branches_group = ([], _("Branches"))
         tags_group = ([], _("Tags"))
-        _hg = cs.repository.alias == 'hg'
         for chs in changesets:
-            #_branch = '(%s)' % chs.branch if _hg else ''
+            #_branch = '(%s)' % chs.branch if (cs.repository.alias == 'hg') else ''
             _branch = chs.branch
             n_desc = '%s (%s)' % (h.show_id(chs), _branch)
             changesets_group[0].append((chs.raw_id, n_desc,))
--- a/kallithea/controllers/pullrequests.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/controllers/pullrequests.py	Tue Aug 12 13:08:23 2014 +0200
@@ -552,7 +552,7 @@
             return redirect(url('pullrequest_show', repo_name=repo_name,
                                 pull_request_id=pull_request_id))
 
-        comm = ChangesetCommentsModel().create(
+        ChangesetCommentsModel().create(
             text=_('Closed, replaced by %s .') % url('pullrequest_show',
                                                    repo_name=old_pull_request.other_repo.repo_name,
                                                    pull_request_id=pull_request.pull_request_id,
--- a/kallithea/lib/celerylib/tasks.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/lib/celerylib/tasks.py	Tue Aug 12 13:08:23 2014 +0200
@@ -74,7 +74,6 @@
 @dbsession
 def whoosh_index(repo_location, full_index):
     from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
-    log = get_logger(whoosh_index)
     DBS = get_session()
 
     index_location = config['index_dir']
@@ -263,7 +262,6 @@
     :param html_body: html version of body
     """
     log = get_logger(send_email)
-    DBS = get_session()
     assert isinstance(recipients, list), recipients
 
     email_config = config
@@ -427,7 +425,7 @@
     try:
         fork_of = RepoModel(DBS)._get_repo(form_data.get('fork_parent_id'))
 
-        fork_repo = RepoModel(DBS)._create_repo(
+        RepoModel(DBS)._create_repo(
             repo_name=repo_name_full,
             repo_type=repo_type,
             description=form_data['description'],
@@ -443,7 +441,7 @@
                       fork_of.repo_name, '', DBS)
         DBS.commit()
 
-        update_after_clone = form_data['update_after_clone']
+        update_after_clone = form_data['update_after_clone'] # FIXME - unused!
         source_repo_path = os.path.join(base_path, fork_of.repo_name)
 
         # now create this repo on Filesystem
--- a/kallithea/lib/vcs/backends/git/changeset.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/lib/vcs/backends/git/changeset.py	Tue Aug 12 13:08:23 2014 +0200
@@ -187,7 +187,7 @@
         """
         Returns list of children changesets.
         """
-        rev_filter = _git_path = settings.GIT_REV_FILTER
+        rev_filter = settings.GIT_REV_FILTER
         so, se = self.repository.run_git_command(
             "rev-list %s --children" % (rev_filter)
         )
--- a/kallithea/lib/vcs/backends/git/repository.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/lib/vcs/backends/git/repository.py	Tue Aug 12 13:08:23 2014 +0200
@@ -260,7 +260,7 @@
         except KeyError:
             return []
 
-        rev_filter = _git_path = settings.GIT_REV_FILTER
+        rev_filter = settings.GIT_REV_FILTER
         cmd = 'rev-list %s --reverse --date-order' % (rev_filter)
         try:
             so, se = self.run_git_command(cmd)
@@ -556,7 +556,7 @@
             cmd_template += ' $branch_name'
             cmd_params['branch_name'] = branch_name
         else:
-            rev_filter = _git_path = settings.GIT_REV_FILTER
+            rev_filter = settings.GIT_REV_FILTER
             cmd_template += ' %s' % (rev_filter)
 
         cmd = string.Template(cmd_template).safe_substitute(**cmd_params)
--- a/kallithea/lib/vcs/backends/hg/repository.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/lib/vcs/backends/hg/repository.py	Tue Aug 12 13:08:23 2014 +0200
@@ -337,7 +337,7 @@
 
         # now check if it's a proper hg repo
         try:
-            repo_id = httppeer(repoui or ui.ui(), url).lookup('tip')
+            httppeer(repoui or ui.ui(), url).lookup('tip')
         except Exception, e:
             raise urllib2.URLError(
                 "url [%s] does not look like an hg repo org_exc: %s"
--- a/kallithea/model/repo.py	Tue Aug 12 13:08:23 2014 +0200
+++ b/kallithea/model/repo.py	Tue Aug 12 13:08:23 2014 +0200
@@ -553,7 +553,6 @@
                 raise AttachedForksError()
 
             old_repo_dict = repo.get_dict()
-            owner = repo.user
             try:
                 self.sa.delete(repo)
                 if fs_remove: