[PATCH 4/9] trivial: Reorder imports
Stephen Finucane
stephen.finucane at intel.com
Mon Nov 30 09:10:45 AEDT 2015
Imports are easier to read if they are grouped by type (standard
library, third party, application) and organised alphabetically. Make
it so.
Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
patchwork/admin.py | 4 ++--
patchwork/bin/update-patchwork-status.py | 4 ++--
patchwork/filters.py | 12 +++++++-----
patchwork/forms.py | 1 +
patchwork/management/commands/cron.py | 1 +
patchwork/management/commands/retag.py | 1 +
patchwork/paginator.py | 3 ++-
patchwork/parser.py | 3 ++-
patchwork/requestcontext.py | 5 +++--
patchwork/templatetags/listurl.py | 8 +++++---
patchwork/templatetags/patch.py | 2 +-
patchwork/templatetags/person.py | 7 +++++--
patchwork/templatetags/syntax.py | 4 +++-
patchwork/tests/test_bundles.py | 6 ++++--
patchwork/tests/test_checks.py | 3 ++-
patchwork/tests/test_confirm.py | 4 +++-
patchwork/tests/test_encodings.py | 9 ++++++---
patchwork/tests/test_expiry.py | 7 +++++--
patchwork/tests/test_filters.py | 3 +++
patchwork/tests/test_list.py | 15 +++++++++------
patchwork/tests/test_mail_settings.py | 5 ++++-
patchwork/tests/test_mboxviews.py | 12 ++++++++----
patchwork/tests/test_notifications.py | 7 +++++--
patchwork/tests/test_patchparser.py | 20 +++++++++++---------
patchwork/tests/test_person.py | 6 ++++--
patchwork/tests/test_registration.py | 9 ++++++---
patchwork/tests/test_tags.py | 10 ++++++----
patchwork/tests/test_updates.py | 4 +++-
patchwork/tests/test_user.py | 7 ++++---
patchwork/tests/test_user_browser.py | 1 +
patchwork/tests/test_xmlrpc.py | 7 +++++--
patchwork/tests/utils.py | 13 +++++++------
patchwork/urls.py | 3 ++-
patchwork/utils.py | 15 +++++++++------
patchwork/views/__init__.py | 16 ++++++++--------
patchwork/views/base.py | 13 +++++++------
patchwork/views/bundle.py | 11 ++++++-----
patchwork/views/mail.py | 11 ++++++-----
patchwork/views/patch.py | 7 ++++---
patchwork/views/project.py | 5 +++--
patchwork/views/user.py | 23 ++++++++++++-----------
patchwork/views/xmlrpc.py | 4 ++--
42 files changed, 190 insertions(+), 121 deletions(-)
diff --git a/patchwork/admin.py b/patchwork/admin.py
index 4723a4b..bada5a6 100644
--- a/patchwork/admin.py
+++ b/patchwork/admin.py
@@ -21,8 +21,8 @@ from __future__ import absolute_import
from django.contrib import admin
-from patchwork.models import (
- Project, Person, UserProfile, State, Patch, Comment, Bundle, Tag, Check)
+from patchwork.models import (Project, Person, UserProfile, State, Patch,
+ Comment, Bundle, Tag, Check)
class ProjectAdmin(admin.ModelAdmin):
diff --git a/patchwork/bin/update-patchwork-status.py b/patchwork/bin/update-patchwork-status.py
index 44f0d0a..ee27252 100755
--- a/patchwork/bin/update-patchwork-status.py
+++ b/patchwork/bin/update-patchwork-status.py
@@ -21,9 +21,9 @@
from __future__ import print_function
-import sys
-import subprocess
from optparse import OptionParser
+import subprocess
+import sys
def commits(options, revlist):
cmd = ['git', 'rev-list', revlist]
diff --git a/patchwork/filters.py b/patchwork/filters.py
index bb752fb..a260ef1 100644
--- a/patchwork/filters.py
+++ b/patchwork/filters.py
@@ -17,15 +17,17 @@
# 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 patchwork.models import Person, State
-from django.utils.safestring import mark_safe
-from django.utils.html import escape
-from django.contrib.auth.models import User
from urllib import quote
+from django.contrib.auth.models import User
+from django.utils.html import escape
+from django.utils.safestring import mark_safe
+
+from patchwork.models import Person, State
+
+
class Filter(object):
def __init__(self, filters):
self.filters = filters
diff --git a/patchwork/forms.py b/patchwork/forms.py
index b2d1236..ac0d7c9 100644
--- a/patchwork/forms.py
+++ b/patchwork/forms.py
@@ -24,6 +24,7 @@ from django import forms
from patchwork.models import Patch, State, Bundle, UserProfile
+
class RegistrationForm(forms.Form):
first_name = forms.CharField(max_length = 30, required = False)
last_name = forms.CharField(max_length = 30, required = False)
diff --git a/patchwork/management/commands/cron.py b/patchwork/management/commands/cron.py
index 0367945..4272177 100644
--- a/patchwork/management/commands/cron.py
+++ b/patchwork/management/commands/cron.py
@@ -18,6 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.core.management.base import BaseCommand
+
from patchwork.utils import send_notifications, do_expiry
diff --git a/patchwork/management/commands/retag.py b/patchwork/management/commands/retag.py
index 2df82e4..8617ff4 100644
--- a/patchwork/management/commands/retag.py
+++ b/patchwork/management/commands/retag.py
@@ -18,6 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.core.management.base import BaseCommand
+
from patchwork.models import Patch
diff --git a/patchwork/paginator.py b/patchwork/paginator.py
index a409e89..dbbcbaa 100644
--- a/patchwork/paginator.py
+++ b/patchwork/paginator.py
@@ -19,8 +19,9 @@
from __future__ import absolute_import
-from django.core import paginator
from django.conf import settings
+from django.core import paginator
+
DEFAULT_PATCHES_PER_PAGE = 100
LONG_PAGE_THRESHOLD = 30
diff --git a/patchwork/parser.py b/patchwork/parser.py
index a63efed..a7fa89c 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -22,9 +22,10 @@
from __future__ import absolute_import
from __future__ import print_function
+from collections import Counter
import hashlib
import re
-from collections import Counter
+
_hunk_re = re.compile('^\@\@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? \@\@')
_filename_re = re.compile('^(---|\+\+\+) (\S+)')
diff --git a/patchwork/requestcontext.py b/patchwork/requestcontext.py
index 413af4d..ea327e5 100644
--- a/patchwork/requestcontext.py
+++ b/patchwork/requestcontext.py
@@ -19,10 +19,11 @@
from __future__ import absolute_import
+from django.conf import settings
+from django.contrib.sites.models import Site
from django.template import RequestContext
from django.utils.html import escape
-from django.contrib.sites.models import Site
-from django.conf import settings
+
from patchwork.filters import Filters
from patchwork.models import Bundle, Project
diff --git a/patchwork/templatetags/listurl.py b/patchwork/templatetags/listurl.py
index 9e6e9f1..118fd58 100644
--- a/patchwork/templatetags/listurl.py
+++ b/patchwork/templatetags/listurl.py
@@ -19,12 +19,14 @@
from __future__ import absolute_import
+from django.conf import settings
+from django.core.urlresolvers import reverse, NoReverseMatch
from django import template
-from django.utils.html import escape
from django.utils.encoding import smart_str
+from django.utils.html import escape
+
from patchwork.filters import filterclasses
-from django.conf import settings
-from django.core.urlresolvers import reverse, NoReverseMatch
+
register = template.Library()
diff --git a/patchwork/templatetags/patch.py b/patchwork/templatetags/patch.py
index 79cc923..7b79b7c 100644
--- a/patchwork/templatetags/patch.py
+++ b/patchwork/templatetags/patch.py
@@ -25,8 +25,8 @@ from django.utils.safestring import mark_safe
from patchwork.models import Check
-register = template.Library()
+register = template.Library()
@register.filter(name='patch_tags')
def patch_tags(patch):
diff --git a/patchwork/templatetags/person.py b/patchwork/templatetags/person.py
index b575689..a3d43a9 100644
--- a/patchwork/templatetags/person.py
+++ b/patchwork/templatetags/person.py
@@ -19,12 +19,15 @@
from __future__ import absolute_import
+import re
+
+from django.core.urlresolvers import reverse
from django import template
from django.utils.html import escape
from django.utils.safestring import mark_safe
-from django.core.urlresolvers import reverse
+
from patchwork.filters import SubmitterFilter
-import re
+
register = template.Library()
diff --git a/patchwork/templatetags/syntax.py b/patchwork/templatetags/syntax.py
index bf90b87..3988f61 100644
--- a/patchwork/templatetags/syntax.py
+++ b/patchwork/templatetags/syntax.py
@@ -19,10 +19,12 @@
from __future__ import absolute_import
+import re
+
from django import template
from django.utils.html import escape
from django.utils.safestring import mark_safe
-import re
+
register = template.Library()
diff --git a/patchwork/tests/test_bundles.py b/patchwork/tests/test_bundles.py
index 2a877d0..233e129 100644
--- a/patchwork/tests/test_bundles.py
+++ b/patchwork/tests/test_bundles.py
@@ -19,12 +19,14 @@
from __future__ import absolute_import
-import unittest
import datetime
+import unittest
+
+from django.conf import settings
from django.test import TestCase
from django.test.client import Client
from django.utils.http import urlencode
-from django.conf import settings
+
from patchwork.models import Patch, Bundle, BundlePatch, Person
from patchwork.tests.utils import defaults, create_user, find_in_context
diff --git a/patchwork/tests/test_checks.py b/patchwork/tests/test_checks.py
index 6d4f7e3..8cf997b 100644
--- a/patchwork/tests/test_checks.py
+++ b/patchwork/tests/test_checks.py
@@ -17,7 +17,8 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from datetime import datetime as dt, timedelta
+from datetime import datetime as dt
+from datetime import timedelta
from django.conf import settings
from django.db import connection
diff --git a/patchwork/tests/test_confirm.py b/patchwork/tests/test_confirm.py
index 9fe938e..ba6a095 100644
--- a/patchwork/tests/test_confirm.py
+++ b/patchwork/tests/test_confirm.py
@@ -17,11 +17,13 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.test import TestCase
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person
+
def _confirmation_url(conf):
return reverse('patchwork.views.confirm', kwargs = {'key': conf.key})
diff --git a/patchwork/tests/test_encodings.py b/patchwork/tests/test_encodings.py
index b639078..252746f 100644
--- a/patchwork/tests/test_encodings.py
+++ b/patchwork/tests/test_encodings.py
@@ -17,13 +17,16 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import os
import time
+import unittest
+
+from django.test.client import Client
+from django.test import TestCase
+
from patchwork.models import Patch, Person
from patchwork.tests.utils import defaults, read_patch
-from django.test import TestCase
-from django.test.client import Client
+
class UTF8PatchViewTest(TestCase):
fixtures = ['default_states']
diff --git a/patchwork/tests/test_expiry.py b/patchwork/tests/test_expiry.py
index ca22970..970db9f 100644
--- a/patchwork/tests/test_expiry.py
+++ b/patchwork/tests/test_expiry.py
@@ -17,14 +17,17 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import datetime
-from django.test import TestCase
+import unittest
+
from django.contrib.auth.models import User
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person, Patch
from patchwork.tests.utils import create_user, defaults
from patchwork.utils import do_expiry
+
class TestRegistrationExpiry(TestCase):
fixtures = ['default_states']
diff --git a/patchwork/tests/test_filters.py b/patchwork/tests/test_filters.py
index 2c464e5..ae1ff7c 100644
--- a/patchwork/tests/test_filters.py
+++ b/patchwork/tests/test_filters.py
@@ -18,10 +18,13 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import unittest
+
from django.test import TestCase
from django.test.client import Client
+
from patchwork.tests.utils import defaults, create_user, find_in_context
+
class FilterQueryStringTest(TestCase):
def testFilterQSEscaping(self):
"""test that filter fragments in a query string are properly escaped,
diff --git a/patchwork/tests/test_list.py b/patchwork/tests/test_list.py
index 44cfc92..69c3d24 100644
--- a/patchwork/tests/test_list.py
+++ b/patchwork/tests/test_list.py
@@ -19,16 +19,19 @@
from __future__ import absolute_import
-import unittest
-import random
import datetime
-import string
+import random
import re
-from django.test import TestCase
+import string
+import unittest
+
+from django.core.urlresolvers import reverse
from django.test.client import Client
-from patchwork.tests.utils import defaults, create_user, find_in_context
+from django.test import TestCase
+
from patchwork.models import Person, Patch
-from django.core.urlresolvers import reverse
+from patchwork.tests.utils import defaults, create_user, find_in_context
+
class EmptyPatchListTest(TestCase):
diff --git a/patchwork/tests/test_mail_settings.py b/patchwork/tests/test_mail_settings.py
index 477f39f..a3956a9 100644
--- a/patchwork/tests/test_mail_settings.py
+++ b/patchwork/tests/test_mail_settings.py
@@ -18,12 +18,15 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import re
-from django.test import TestCase
+
from django.core import mail
from django.core.urlresolvers import reverse
+from django.test import TestCase
+
from patchwork.models import EmailOptout, EmailConfirmation, Person
from patchwork.tests.utils import create_user, error_strings
+
class MailSettingsTest(TestCase):
def setUp(self):
diff --git a/patchwork/tests/test_mboxviews.py b/patchwork/tests/test_mboxviews.py
index fbea322..8c98351 100644
--- a/patchwork/tests/test_mboxviews.py
+++ b/patchwork/tests/test_mboxviews.py
@@ -19,15 +19,19 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
-import email
import datetime
-import dateutil.parser, dateutil.tz
-from django.test import TestCase
+import dateutil.parser
+import dateutil.tz
+import email
+import unittest
+
from django.test.client import Client
+from django.test import TestCase
+
from patchwork.models import Patch, Comment, Person
from patchwork.tests.utils import defaults, create_user, find_in_context
+
class MboxPatchResponseTest(TestCase):
fixtures = ['default_states']
diff --git a/patchwork/tests/test_notifications.py b/patchwork/tests/test_notifications.py
index 37adb8d..e0cc153 100644
--- a/patchwork/tests/test_notifications.py
+++ b/patchwork/tests/test_notifications.py
@@ -18,13 +18,16 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import datetime
-from django.test import TestCase
-from django.core import mail
+
from django.conf import settings
+from django.core import mail
+from django.test import TestCase
+
from patchwork.models import Patch, State, PatchChangeNotification, EmailOptout
from patchwork.tests.utils import defaults
from patchwork.utils import send_notifications
+
class PatchNotificationModelTest(TestCase):
fixtures = ['default_states']
diff --git a/patchwork/tests/test_patchparser.py b/patchwork/tests/test_patchparser.py
index 77668e5..9f23bf2 100644
--- a/patchwork/tests/test_patchparser.py
+++ b/patchwork/tests/test_patchparser.py
@@ -17,16 +17,21 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import os
from email import message_from_string
+from email.mime.text import MIMEText
from email.utils import make_msgid
+import os
+
from django.test import TestCase
-from patchwork.models import Project, Person, Patch, Comment, State, \
- get_default_initial_patch_state
-from patchwork.tests.utils import read_patch, read_mail, create_email, \
- defaults, create_user
-from email.mime.text import MIMEText
+from patchwork.bin.parsemail import (find_content, find_author,
+ find_project_by_header, parse_mail,
+ split_prefixes, clean_subject)
+from patchwork.models import (Project, Person, Patch, Comment, State,
+ get_default_initial_patch_state)
+from patchwork.tests.utils import (read_patch, read_mail, create_email,
+ defaults, create_user)
+
class PatchTest(TestCase):
fixtures = ['default_states']
@@ -34,9 +39,6 @@ class PatchTest(TestCase):
default_subject = defaults.subject
project = defaults.project
-from patchwork.bin.parsemail import (find_content, find_author,
- find_project_by_header, parse_mail,
- split_prefixes, clean_subject)
class InlinePatchTest(PatchTest):
patch_filename = '0001-add-line.patch'
diff --git a/patchwork/tests/test_person.py b/patchwork/tests/test_person.py
index ddbbb7c..7d82ce8 100644
--- a/patchwork/tests/test_person.py
+++ b/patchwork/tests/test_person.py
@@ -19,11 +19,13 @@
from __future__ import absolute_import
+import json
import unittest
-from django.test import TestCase
+
from django.test.client import Client
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person, Bundle
-import json
class SubmitterCompletionTest(TestCase):
def setUp(self):
diff --git a/patchwork/tests/test_registration.py b/patchwork/tests/test_registration.py
index 845b60b..bf32ae7 100644
--- a/patchwork/tests/test_registration.py
+++ b/patchwork/tests/test_registration.py
@@ -18,14 +18,17 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import unittest
-from django.test import TestCase
-from django.test.client import Client
+
+from django.contrib.auth.models import User
from django.core import mail
from django.core.urlresolvers import reverse
-from django.contrib.auth.models import User
+from django.test.client import Client
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person
from patchwork.tests.utils import create_user
+
def _confirmation_url(conf):
return reverse('patchwork.views.confirm', kwargs = {'key': conf.key})
diff --git a/patchwork/tests/test_tags.py b/patchwork/tests/test_tags.py
index a1e03f5..0f7c14f 100644
--- a/patchwork/tests/test_tags.py
+++ b/patchwork/tests/test_tags.py
@@ -17,15 +17,17 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
import datetime
+import unittest
+
+from django.conf import settings
+from django.db import connection
from django.test import TestCase, TransactionTestCase
+
from patchwork.models import Project, Patch, Comment, Tag, PatchTag
-from patchwork.tests.utils import defaults
from patchwork.parser import extract_tags
+from patchwork.tests.utils import defaults
-from django.conf import settings
-from django.db import connection
class ExtractTagsTest(TestCase):
diff --git a/patchwork/tests/test_updates.py b/patchwork/tests/test_updates.py
index d2f4126..c9b4f33 100644
--- a/patchwork/tests/test_updates.py
+++ b/patchwork/tests/test_updates.py
@@ -17,11 +17,13 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from django.test import TestCase
from django.core.urlresolvers import reverse
+from django.test import TestCase
+
from patchwork.models import Patch, Person, State
from patchwork.tests.utils import defaults, create_maintainer
+
class MultipleUpdateTest(TestCase):
fixtures = ['default_states']
diff --git a/patchwork/tests/test_user.py b/patchwork/tests/test_user.py
index 7d198fe..dba8d33 100644
--- a/patchwork/tests/test_user.py
+++ b/patchwork/tests/test_user.py
@@ -17,11 +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 django.test import TestCase
-from django.core import mail
-from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.auth.models import User
+from django.core import mail
+from django.core.urlresolvers import reverse
+from django.test import TestCase
+
from patchwork.models import EmailConfirmation, Person, Bundle, UserProfile
from patchwork.tests.utils import defaults, error_strings
diff --git a/patchwork/tests/test_user_browser.py b/patchwork/tests/test_user_browser.py
index 2b9ed2e..dd6b6c0 100644
--- a/patchwork/tests/test_user_browser.py
+++ b/patchwork/tests/test_user_browser.py
@@ -20,6 +20,7 @@
from patchwork.tests.browser import SeleniumTestCase
from patchwork.tests.test_user import TestUser
+
class LoginTestCase(SeleniumTestCase):
def setUp(self):
super(LoginTestCase, self).setUp()
diff --git a/patchwork/tests/test_xmlrpc.py b/patchwork/tests/test_xmlrpc.py
index 2c1a18a..06522ff 100644
--- a/patchwork/tests/test_xmlrpc.py
+++ b/patchwork/tests/test_xmlrpc.py
@@ -19,12 +19,15 @@
import unittest
import xmlrpclib
-from django.test import LiveServerTestCase
-from django.core.urlresolvers import reverse
+
from django.conf import settings
+from django.core.urlresolvers import reverse
+from django.test import LiveServerTestCase
+
from patchwork.models import Person, Patch
from patchwork.tests.utils import defaults
+
@unittest.skipUnless(settings.ENABLE_XMLRPC,
"requires xmlrpc interface (use the ENABLE_XMLRPC setting)")
class XMLRPCTest(LiveServerTestCase):
diff --git a/patchwork/tests/utils.py b/patchwork/tests/utils.py
index 931462b..061a64e 100644
--- a/patchwork/tests/utils.py
+++ b/patchwork/tests/utils.py
@@ -17,16 +17,17 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import os
import codecs
-from patchwork.models import Project, Person
-from django.contrib.auth.models import User
-from django.forms.fields import EmailField
-
from email import message_from_file
-from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
from email.utils import make_msgid
+import os
+
+from django.contrib.auth.models import User
+from django.forms.fields import EmailField
+
+from patchwork.models import Project, Person
# helper functions for tests
diff --git a/patchwork/urls.py b/patchwork/urls.py
index d6c2501..cf36710 100644
--- a/patchwork/urls.py
+++ b/patchwork/urls.py
@@ -17,11 +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 django.conf.urls import patterns, url, include
from django.conf import settings
+from django.conf.urls import patterns, url, include
from django.contrib import admin
from django.contrib.auth import views as auth_views
+
admin.autodiscover()
urlpatterns = patterns('',
diff --git a/patchwork/utils.py b/patchwork/utils.py
index 62ae00f..f151c12 100644
--- a/patchwork/utils.py
+++ b/patchwork/utils.py
@@ -19,18 +19,21 @@
from __future__ import absolute_import
-import itertools
import datetime
-from django.shortcuts import get_object_or_404
-from django.template.loader import render_to_string
+import itertools
+
+from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
-from django.conf import settings
from django.core.mail import EmailMessage
from django.db.models import Max, Q, F
from django.db.utils import IntegrityError
-from patchwork.models import Bundle, Project, BundlePatch, UserProfile, \
- PatchChangeNotification, EmailOptout, EmailConfirmation
+from django.shortcuts import get_object_or_404
+from django.template.loader import render_to_string
+
+from patchwork.models import (Bundle, Project, BundlePatch, UserProfile,
+ PatchChangeNotification, EmailOptout,
+ EmailConfirmation)
def get_patch_ids(d, prefix = 'patch_id'):
ids = []
diff --git a/patchwork/views/__init__.py b/patchwork/views/__init__.py
index b0b4e88..67894c3 100644
--- a/patchwork/views/__init__.py
+++ b/patchwork/views/__init__.py
@@ -19,19 +19,19 @@
from __future__ import absolute_import
+import datetime
+from email.encoders import encode_7or8bit
+from email.header import Header
+from email.mime.nonmultipart import MIMENonMultipart
+from email.parser import HeaderParser
+import email.utils
+import re
+
from .base import *
from patchwork.utils import Order, get_patch_ids, bundle_actions, set_bundle
from patchwork.paginator import Paginator
from patchwork.forms import MultiplePatchForm
from patchwork.models import Comment
-import re
-import datetime
-
-from email.mime.nonmultipart import MIMENonMultipart
-from email.encoders import encode_7or8bit
-from email.parser import HeaderParser
-from email.header import Header
-import email.utils
def generic_list(request, project, view,
view_args = {}, filter_settings = [], patches = None,
diff --git a/patchwork/views/base.py b/patchwork/views/base.py
index 9f21012..61fb0f9 100644
--- a/patchwork/views/base.py
+++ b/patchwork/views/base.py
@@ -21,14 +21,15 @@ from __future__ import absolute_import
import json
-from patchwork.models import Patch, Project, Person, EmailConfirmation
-from django.shortcuts import render_to_response, get_object_or_404
-from django.http import HttpResponse, HttpResponseRedirect, Http404
-from patchwork.requestcontext import PatchworkRequestContext
-from django.core import urlresolvers
-from django.template.loader import render_to_string
from django.conf import settings
+from django.core import urlresolvers
from django.db.models import Q
+from django.http import HttpResponse, HttpResponseRedirect, Http404
+from django.shortcuts import render_to_response, get_object_or_404
+from django.template.loader import render_to_string
+
+from patchwork.models import Patch, Project, Person, EmailConfirmation
+from patchwork.requestcontext import PatchworkRequestContext
def projects(request):
context = PatchworkRequestContext(request)
diff --git a/patchwork/views/bundle.py b/patchwork/views/bundle.py
index 48d7c67..a7db717 100644
--- a/patchwork/views/bundle.py
+++ b/patchwork/views/bundle.py
@@ -21,15 +21,16 @@ from __future__ import absolute_import
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
-from django.shortcuts import render_to_response, get_object_or_404
-from patchwork.requestcontext import PatchworkRequestContext
-from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
import django.core.urlresolvers
+from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound
+from django.shortcuts import render_to_response, get_object_or_404
+
+from patchwork.filters import DelegateFilter
+from patchwork.forms import BundleForm, DeleteBundleForm
from patchwork.models import Patch, Bundle, BundlePatch, Project
+from patchwork.requestcontext import PatchworkRequestContext
from patchwork.utils import get_patch_ids
-from patchwork.forms import BundleForm, DeleteBundleForm
from patchwork.views import generic_list, patch_to_mbox
-from patchwork.filters import DelegateFilter
@login_required
def setbundle(request):
diff --git a/patchwork/views/mail.py b/patchwork/views/mail.py
index 46c8768..5e38bba 100644
--- a/patchwork/views/mail.py
+++ b/patchwork/views/mail.py
@@ -19,15 +19,16 @@
from __future__ import absolute_import
-from patchwork.requestcontext import PatchworkRequestContext
-from patchwork.models import EmailOptout, EmailConfirmation
-from patchwork.forms import OptinoutRequestForm, EmailForm
-from django.shortcuts import render_to_response
-from django.template.loader import render_to_string
from django.conf import settings as conf_settings
from django.core.mail import send_mail
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
+from django.shortcuts import render_to_response
+from django.template.loader import render_to_string
+
+from patchwork.forms import OptinoutRequestForm, EmailForm
+from patchwork.models import EmailOptout, EmailConfirmation
+from patchwork.requestcontext import PatchworkRequestContext
def settings(request):
context = PatchworkRequestContext(request)
diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py
index 30aeef2..3c43cd7 100644
--- a/patchwork/views/patch.py
+++ b/patchwork/views/patch.py
@@ -19,11 +19,12 @@
from __future__ import absolute_import
-from patchwork.models import Patch, Project, Bundle
+from django.http import HttpResponse, HttpResponseForbidden
+from django.shortcuts import render_to_response, get_object_or_404
+
from patchwork.forms import PatchForm, CreateBundleForm
+from patchwork.models import Patch, Project, Bundle
from patchwork.requestcontext import PatchworkRequestContext
-from django.shortcuts import render_to_response, get_object_or_404
-from django.http import HttpResponse, HttpResponseForbidden
from patchwork.views import generic_list, patch_to_mbox
def patch(request, patch_id):
diff --git a/patchwork/views/project.py b/patchwork/views/project.py
index 024799e..4360bb4 100644
--- a/patchwork/views/project.py
+++ b/patchwork/views/project.py
@@ -19,9 +19,10 @@
from __future__ import absolute_import
-from patchwork.models import Patch, Project
-from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.models import User
+from django.shortcuts import render_to_response, get_object_or_404
+
+from patchwork.models import Patch, Project
from patchwork.requestcontext import PatchworkRequestContext
def project(request, project_id):
diff --git a/patchwork/views/user.py b/patchwork/views/user.py
index 97d15a7..9439380 100644
--- a/patchwork/views/user.py
+++ b/patchwork/views/user.py
@@ -19,22 +19,23 @@
from __future__ import absolute_import
-from django.contrib.auth.decorators import login_required
-from patchwork.requestcontext import PatchworkRequestContext
-from django.shortcuts import render_to_response, get_object_or_404
from django.contrib import auth
+from django.contrib.auth.decorators import login_required
from django.contrib.sites.models import Site
-from django.http import HttpResponseRedirect
-from patchwork.models import Project, Bundle, Person, EmailConfirmation, \
- State, EmailOptout
-from patchwork.forms import UserProfileForm, UserPersonLinkForm, \
- RegistrationForm
-from patchwork.filters import DelegateFilter
-from patchwork.views import generic_list
-from django.template.loader import render_to_string
from django.conf import settings
from django.core.mail import send_mail
import django.core.urlresolvers
+from django.http import HttpResponseRedirect
+from django.shortcuts import render_to_response, get_object_or_404
+from django.template.loader import render_to_string
+
+from patchwork.filters import DelegateFilter
+from patchwork.forms import (UserProfileForm, UserPersonLinkForm,
+ RegistrationForm)
+from patchwork.models import (Project, Bundle, Person, EmailConfirmation,
+ State, EmailOptout)
+from patchwork.requestcontext import PatchworkRequestContext
+from patchwork.views import generic_list
def register(request):
context = PatchworkRequestContext(request)
diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py
index 3b0be9f..9d7ef07 100644
--- a/patchwork/views/xmlrpc.py
+++ b/patchwork/views/xmlrpc.py
@@ -22,9 +22,9 @@
from __future__ import absolute_import
-from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
-from DocXMLRPCServer import XMLRPCDocGenerator
import base64
+from DocXMLRPCServer import XMLRPCDocGenerator
+from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
import sys
import xmlrpclib
--
2.0.0
More information about the Patchwork
mailing list