[PATCH 05/11] trivial: Remove additional dead code

Finucane, Stephen stephen.finucane at intel.com
Wed Aug 19 23:37:26 AEST 2015


> On Tue, Jun 30, 2015 at 09:52:03AM +0100, Stephen Finucane wrote:
> > Remove dead files and functions as highlighted by coverage and manual
> > inspection.
> 
> Again spurious white space addition and random code changes, presumably
> to respect PEP8.

Right you are: I'll split this (and other patches) in v2.

> 
> > Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
> > ---
> >  patchwork/context_processors.py | 32 ----------------------------
> >  patchwork/requestcontext.py     | 46 +++++++++++++++++++----------------
> ------
> >  2 files changed, 21 insertions(+), 57 deletions(-)
> >  delete mode 100644 patchwork/context_processors.py
> >
> > diff --git a/patchwork/context_processors.py
> b/patchwork/context_processors.py
> > deleted file mode 100644
> > index f4ab5a9..0000000
> > --- a/patchwork/context_processors.py
> > +++ /dev/null
> > @@ -1,32 +0,0 @@
> > -# Patchwork - automated patch tracking system
> > -# Copyright (C) 2008 Jeremy Kerr <jk at ozlabs.org>
> > -#
> > -# This file is part of the Patchwork package.
> > -#
> > -# Patchwork is free software; you can redistribute it and/or modify
> > -# it under the terms of the GNU General Public License as published by
> > -# the Free Software Foundation; either version 2 of the License, or
> > -# (at your option) any later version.
> > -#
> > -# Patchwork is distributed in the hope that it will be useful,
> > -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > -# GNU General Public License for more details.
> > -#
> > -# You should have received a copy of the GNU General Public License
> > -# along with Patchwork; if not, write to the Free Software
> > -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
> USA
> > -
> > -
> > -from patchwork.models import Bundle
> > -from patchwork.utils import order_map, get_order
> > -
> > -def bundle(request):
> > -    user = request.user
> > -    if not user.is_authenticated():
> > -        return {}
> > -    return {'bundles': Bundle.objects.filter(owner = user)}
> > -
> > -
> > -def patchlists(request):
> > -
> > diff --git a/patchwork/requestcontext.py b/patchwork/requestcontext.py
> > index 342d380..8ad6049 100644
> > --- a/patchwork/requestcontext.py
> > +++ b/patchwork/requestcontext.py
> > @@ -24,35 +24,31 @@ from django.conf import settings
> >  from patchwork.filters import Filters
> >  from patchwork.models import Bundle, Project
> >
> > +
> >  def bundle(request):
> >      user = request.user
> >      if not user.is_authenticated():
> >          return {}
> > -    return {'bundles': Bundle.objects.filter(owner = user)}
> > -
> > -def _params_as_qs(params):
> > -    return '&'.join([ '%s=%s' % (escape(k), escape(v)) for k, v in
> params ])
> > +    return {'bundles': Bundle.objects.filter(owner=user)}
> >
> > -def _params_as_hidden_fields(params):
> > -    return '\n'.join([ '<input type="hidden" name="%s" value="%s"/>' % \
> > -                (escape(k), escape(v)) for k, v in params ])
> >
> >  class PatchworkRequestContext(RequestContext):
> > -    def __init__(self, request, project = None,
> > -            dict = None, processors = None,
> > -            list_view = None, list_view_params = {}):
> > +
> > +    def __init__(self, request, project=None,
> > +                 dict=None, processors=None,
> > +                 list_view=None, list_view_params={}):
> >          self._project = project
> >          self.filters = Filters(request)
> >          if processors is None:
> >              processors = []
> >          processors.append(bundle)
> > -        super(PatchworkRequestContext, self). \
> > -                __init__(request, dict, processors);
> > +        super(PatchworkRequestContext, self).__init__(
> > +            request, dict, processors)
> >
> >          self.update({
> > -                'filters': self.filters,
> > -                'messages': [],
> > -            })
> > +            'filters': self.filters,
> > +            'messages': [],
> > +        })
> >          if list_view:
> >              params = self.filters.params()
> >              for param in ['order', 'page']:
> > @@ -64,22 +60,22 @@ class PatchworkRequestContext(RequestContext):
> >
> >                  value = data.get(param, None)
> >                  if value:
> > -                        params.append((param, value))
> > +                    params.append((param, value))
> >              self.update({
> >                  'list_view': {
> > -                        'view':         list_view,
> > -                        'view_params':  list_view_params,
> > -                        'params':       params
> > -                }})
> > +                        'view': list_view,
> > +                        'view_params': list_view_params,
> > +                        'params': params
> > +                        }})
> >
> >          self.projects = Project.objects.all()
> >
> >          self.update({
> > -                'project': self.project,
> > -                'site': Site.objects.get_current(),
> > -                'settings': settings,
> > -                'other_projects': len(self.projects) > 1
> > -            })
> > +            'project': self.project,
> > +            'site': Site.objects.get_current(),
> > +            'settings': settings,
> > +            'other_projects': len(self.projects) > 1
> > +        })
> >
> >      def _set_project(self, project):
> >          self._project = project
> > --
> > 2.0.0
> >
> > _______________________________________________
> > Patchwork mailing list
> > Patchwork at lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/patchwork


More information about the Patchwork mailing list