Cleaned up all imports using isort.

This commit is contained in:
Martin Mahner 2014-12-14 18:03:35 +01:00
parent 611e0f6ea9
commit b25b9b888e
20 changed files with 63 additions and 50 deletions

View file

@ -4,8 +4,8 @@ from django import forms
from django.conf import settings from django.conf import settings
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from dpaste.models import Snippet from .highlight import LEXER_DEFAULT, LEXER_KEYS, LEXER_LIST
from dpaste.highlight import LEXER_LIST, LEXER_DEFAULT, LEXER_KEYS from .models import Snippet
EXPIRE_CHOICES = getattr(settings, 'DPASTE_EXPIRE_CHOICES', ( EXPIRE_CHOICES = getattr(settings, 'DPASTE_EXPIRE_CHOICES', (
('onetime', _(u'One-Time snippet')), ('onetime', _(u'One-Time snippet')),

View file

@ -1,10 +1,9 @@
from pygments import highlight
from pygments.lexers import *
from pygments.formatters import HtmlFormatter
from django.conf import settings from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import escape from django.template.defaultfilters import escape
from django.utils.translation import ugettext_lazy as _
from pygments import highlight
from pygments.formatters import HtmlFormatter
from pygments.lexers import *
""" """
# Get a list of all lexer, and then remove all lexer which have '-' or '+' # Get a list of all lexer, and then remove all lexer which have '-' or '+'

View file

@ -1,9 +1,12 @@
import sys import sys
from optparse import make_option from optparse import make_option
from django.core.management.base import LabelCommand from django.core.management.base import LabelCommand
from django.utils import timezone from django.utils import timezone
from dpaste.models import Snippet from dpaste.models import Snippet
class Command(LabelCommand): class Command(LabelCommand):
option_list = LabelCommand.option_list + ( option_list = LabelCommand.option_list + (
make_option('--dry-run', '-d', action='store_true', dest='dry_run', make_option('--dry-run', '-d', action='store_true', dest='dry_run',

View file

@ -1,4 +1,5 @@
import socket import socket
from django.http import HttpResponseBadRequest from django.http import HttpResponseBadRequest
tor_bl = ( tor_bl = (

View file

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import datetime import datetime
from django.db import models
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration): class Migration(SchemaMigration):

View file

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import datetime import datetime
from django.db import models
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration): class Migration(SchemaMigration):

View file

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import datetime import datetime
from django.db import models
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration): class Migration(SchemaMigration):

View file

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import datetime import datetime
from django.db import models
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration): class Migration(SchemaMigration):

View file

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import datetime import datetime
from django.db import models
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration): class Migration(SchemaMigration):

View file

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import datetime import datetime
from django.db import models
from south.db import db from south.db import db
from south.v2 import SchemaMigration from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration): class Migration(SchemaMigration):

View file

@ -1,13 +1,12 @@
from random import SystemRandom from random import SystemRandom
from django.db import IntegrityError
from django.db import models
from django.core.urlresolvers import reverse
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
import mptt import mptt
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from dpaste.highlight import LEXER_DEFAULT from .highlight import LEXER_DEFAULT
R = SystemRandom() R = SystemRandom()
ONETIME_LIMIT = getattr(settings, 'DPASTE_ONETIME_LIMIT', 2) ONETIME_LIMIT = getattr(settings, 'DPASTE_ONETIME_LIMIT', 2)

View file

@ -1,4 +1,4 @@
from dpaste.settings import * from .settings import *
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG

View file

@ -1,5 +1,6 @@
from django.template import Library from django.template import Library
from dpaste.highlight import pygmentize
from ..highlight import pygmentize
register = Library() register = Library()

View file

@ -1,11 +1,12 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase from django.test import TestCase
from django.test.client import Client
from ..models import Snippet
from ..highlight import PLAIN_CODE from ..highlight import PLAIN_CODE
from ..models import Snippet
class SnippetAPITestCase(TestCase): class SnippetAPITestCase(TestCase):

View file

@ -4,13 +4,13 @@ from datetime import timedelta
from django.core import management from django.core import management
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.test.client import Client
from django.test import TestCase from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings from django.test.utils import override_settings
from ..models import Snippet
from ..forms import EXPIRE_DEFAULT from ..forms import EXPIRE_DEFAULT
from ..highlight import LEXER_DEFAULT, PLAIN_TEXT, PLAIN_CODE from ..highlight import LEXER_DEFAULT, PLAIN_CODE, PLAIN_TEXT
from ..models import Snippet
class SnippetTestCase(TestCase): class SnippetTestCase(TestCase):
@ -377,7 +377,7 @@ class SnippetTestCase(TestCase):
def test_highlighting(self): def test_highlighting(self):
# You can pass any lexer to the pygmentize function and it will # You can pass any lexer to the pygmentize function and it will
# never fail loudly. # never fail loudly.
from dpaste.highlight import pygmentize from ..highlight import pygmentize
pygmentize('code', lexer_name='python') pygmentize('code', lexer_name='python')
pygmentize('code', lexer_name='doesnotexist') pygmentize('code', lexer_name='doesnotexist')

View file

@ -1,5 +1,5 @@
from django.conf.urls import url, patterns
from django.conf import settings from django.conf import settings
from django.conf.urls import patterns, url
L = getattr(settings, 'DPASTE_SLUG_LENGTH', 4) L = getattr(settings, 'DPASTE_SLUG_LENGTH', 4)

View file

@ -1,4 +1,5 @@
from django.conf.urls import url, patterns from django.conf.urls import patterns, url
from ..views import snippet_api from ..views import snippet_api
urlpatterns = patterns('', urlpatterns = patterns('',

View file

@ -1,28 +1,27 @@
import datetime import datetime
import difflib import difflib
import requests
import json import json
from django.shortcuts import (render_to_response, get_object_or_404) import requests
from django.template.context import RequestContext
from django.http import (Http404, HttpResponseRedirect, HttpResponseBadRequest,
HttpResponse)
from django.conf import settings from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.db.models import Count from django.db.models import Count
from django.views.defaults import (page_not_found as django_page_not_found, from django.http import (Http404, HttpResponse, HttpResponseBadRequest,
server_error as django_server_error) HttpResponseRedirect)
from django.shortcuts import get_object_or_404, render_to_response
from django.template.context import RequestContext
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.views.defaults import page_not_found as django_page_not_found
from django.views.defaults import server_error as django_server_error
from pygments.lexers import get_lexer_for_filename from pygments.lexers import get_lexer_for_filename
from pygments.util import ClassNotFound from pygments.util import ClassNotFound
from dpaste.forms import SnippetForm, get_expire_values, EXPIRE_CHOICES from .forms import EXPIRE_CHOICES, get_expire_values, SnippetForm
from dpaste.models import Snippet, ONETIME_LIMIT from .highlight import (LEXER_DEFAULT, LEXER_KEYS, LEXER_LIST,
from dpaste.highlight import (LEXER_DEFAULT, LEXER_KEYS, LEXER_WORDWRAP, LEXER_WORDWRAP, PLAIN_CODE)
LEXER_LIST, PLAIN_CODE) from .models import ONETIME_LIMIT, Snippet
template_globals = { template_globals = {
'site_name': getattr(settings, 'DPASTE_SITE_NAME', 'dpaste.de'), 'site_name': getattr(settings, 'DPASTE_SITE_NAME', 'dpaste.de'),

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python #!/usr/bin/env python
import sys import sys
from django.conf import settings from django.conf import settings
if not settings.configured: if not settings.configured:

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from sys import exit from sys import exit
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand
class Tox(TestCommand): class Tox(TestCommand):
def finalize_options(self): def finalize_options(self):
TestCommand.finalize_options(self) TestCommand.finalize_options(self)