[PATCH v4 4/9] trivial: Cleanup imports in views

Stephen Finucane stephen at that.guru
Sat Mar 11 04:38:02 AEDT 2017


Break each import onto its own line and remove 'absolute_import'
imports, which aren't necessary for Python >= 2.7.

Signed-off-by: Stephen Finucane <stephen at that.guru>
Reviewed-by: Daniel Axtens <dja at axtens.net>
---
 patchwork/views/api.py      |  3 ++-
 patchwork/views/bundle.py   | 23 +++++++++++++----------
 patchwork/views/comment.py  |  2 --
 patchwork/views/cover.py    |  8 ++++----
 patchwork/views/patch.py    | 15 +++++++++------
 patchwork/views/project.py  |  5 ++---
 patchwork/views/pwclient.py |  5 ++---
 patchwork/views/user.py     |  3 ++-
 8 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/patchwork/views/api.py b/patchwork/views/api.py
index 4d79f93..bdd2a69 100644
--- a/patchwork/views/api.py
+++ b/patchwork/views/api.py
@@ -22,7 +22,8 @@ import json
 from django.db.models import Q
 from django.http import HttpResponse
 
-from patchwork.models import Person, User
+from patchwork.models import Person
+from patchwork.models import User
 
 
 MINIMUM_CHARACTERS = 3
diff --git a/patchwork/views/bundle.py b/patchwork/views/bundle.py
index b6959e9..53e1b21 100644
--- a/patchwork/views/bundle.py
+++ b/patchwork/views/bundle.py
@@ -17,17 +17,20 @@
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import absolute_import
-
 from django.contrib.auth.decorators import login_required
-import django.core.urlresolvers
-from django.http import (HttpResponse, HttpResponseRedirect,
-                         HttpResponseNotFound)
-from django.shortcuts import render, get_object_or_404
+from django.core import urlresolvers
+from django.http import HttpResponse
+from django.http import HttpResponseRedirect
+from django.http import HttpResponseNotFound
+from django.shortcuts import get_object_or_404
+from django.shortcuts import render
 
 from patchwork.filters import DelegateFilter
-from patchwork.forms import BundleForm, DeleteBundleForm
-from patchwork.models import Bundle, BundlePatch, Project
+from patchwork.forms import BundleForm
+from patchwork.forms import DeleteBundleForm
+from patchwork.models import Bundle
+from patchwork.models import BundlePatch
+from patchwork.models import Project
 from patchwork.views import generic_list
 from patchwork.views.utils import patch_to_mbox
 
@@ -80,7 +83,7 @@ def bundle_detail(request, username, bundlename):
             if action == 'delete':
                 bundle.delete()
                 return HttpResponseRedirect(
-                    django.core.urlresolvers.reverse('user-profile')
+                    urlresolvers.reverse('user-profile')
                 )
             elif action == 'update':
                 form = BundleForm(request.POST, instance=bundle)
@@ -152,7 +155,7 @@ def bundle_detail_redir(request, bundle_id):
 @login_required
 def bundle_mbox_redir(request, bundle_id):
     bundle = get_object_or_404(Bundle, id=bundle_id, owner=request.user)
-    return HttpResponseRedirect(django.core.urlresolvers.reverse(
+    return HttpResponseRedirect(urlresolvers.reverse(
                                 'bundle-mbox', kwargs={
                                     'username': request.user.username,
                                     'bundlename': bundle.name,
diff --git a/patchwork/views/comment.py b/patchwork/views/comment.py
index 7175105..e4f4f89 100644
--- a/patchwork/views/comment.py
+++ b/patchwork/views/comment.py
@@ -17,8 +17,6 @@
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import absolute_import
-
 from django.core import urlresolvers
 from django import http
 from django import shortcuts
diff --git a/patchwork/views/cover.py b/patchwork/views/cover.py
index fe3eaf2..af1b2f2 100644
--- a/patchwork/views/cover.py
+++ b/patchwork/views/cover.py
@@ -17,14 +17,14 @@
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import absolute_import
-
 from django.core import urlresolvers
 from django.http import Http404
 from django.http import HttpResponseRedirect
-from django.shortcuts import render_to_response, get_object_or_404
+from django.shortcuts import get_object_or_404
+from django.shortcuts import render_to_response
 
-from patchwork.models import CoverLetter, Submission
+from patchwork.models import CoverLetter
+from patchwork.models import Submission
 
 
 def cover_detail(request, cover_id):
diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py
index d1e81d1..a4cea2f 100644
--- a/patchwork/views/patch.py
+++ b/patchwork/views/patch.py
@@ -17,18 +17,21 @@
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import absolute_import
-
 from django.contrib import messages
 from django.core import urlresolvers
 from django.http import Http404
 from django.http import HttpResponse
 from django.http import HttpResponseForbidden
 from django.http import HttpResponseRedirect
-from django.shortcuts import render, get_object_or_404
-
-from patchwork.forms import PatchForm, CreateBundleForm
-from patchwork.models import Patch, Project, Bundle, Submission
+from django.shortcuts import get_object_or_404
+from django.shortcuts import render
+
+from patchwork.forms import CreateBundleForm
+from patchwork.forms import PatchForm
+from patchwork.models import Bundle
+from patchwork.models import Patch
+from patchwork.models import Project
+from patchwork.models import Submission
 from patchwork.views import generic_list
 from patchwork.views.utils import patch_to_mbox
 
diff --git a/patchwork/views/project.py b/patchwork/views/project.py
index de0c67d..6184805 100644
--- a/patchwork/views/project.py
+++ b/patchwork/views/project.py
@@ -17,13 +17,12 @@
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import absolute_import
-
 from django.conf import settings
 from django.contrib.auth.models import User
 from django.core import urlresolvers
 from django.http import HttpResponseRedirect
-from django.shortcuts import get_object_or_404, render
+from django.shortcuts import get_object_or_404
+from django.shortcuts import render
 
 from patchwork.models import Patch
 from patchwork.models import Project
diff --git a/patchwork/views/pwclient.py b/patchwork/views/pwclient.py
index 64fb044..c5dc806 100644
--- a/patchwork/views/pwclient.py
+++ b/patchwork/views/pwclient.py
@@ -17,10 +17,9 @@
 # along with Patchwork; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from __future__ import absolute_import
-
 from django.conf import settings
-from django.shortcuts import get_object_or_404, render
+from django.shortcuts import get_object_or_404
+from django.shortcuts import render
 
 from patchwork.models import Project
 
diff --git a/patchwork/views/user.py b/patchwork/views/user.py
index c182aa3..7c29087 100644
--- a/patchwork/views/user.py
+++ b/patchwork/views/user.py
@@ -26,7 +26,8 @@ from django.conf import settings
 from django.core.mail import send_mail
 from django.core import urlresolvers
 from django.http import HttpResponseRedirect
-from django.shortcuts import render, get_object_or_404
+from django.shortcuts import get_object_or_404
+from django.shortcuts import render
 
 from patchwork.compat import render_to_string
 from patchwork.filters import DelegateFilter
-- 
2.9.3



More information about the Patchwork mailing list