mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-23 11:56:36 +11:00
Cleaned up all imports using isort.
This commit is contained in:
parent
611e0f6ea9
commit
b25b9b888e
20 changed files with 63 additions and 50 deletions
|
@ -4,8 +4,8 @@ from django import forms
|
|||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from dpaste.models import Snippet
|
||||
from dpaste.highlight import LEXER_LIST, LEXER_DEFAULT, LEXER_KEYS
|
||||
from .highlight import LEXER_DEFAULT, LEXER_KEYS, LEXER_LIST
|
||||
from .models import Snippet
|
||||
|
||||
EXPIRE_CHOICES = getattr(settings, 'DPASTE_EXPIRE_CHOICES', (
|
||||
('onetime', _(u'One-Time snippet')),
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
from pygments import highlight
|
||||
from pygments.lexers import *
|
||||
from pygments.formatters import HtmlFormatter
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
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 '+'
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import sys
|
||||
from optparse import make_option
|
||||
|
||||
from django.core.management.base import LabelCommand
|
||||
from django.utils import timezone
|
||||
|
||||
from dpaste.models import Snippet
|
||||
|
||||
|
||||
class Command(LabelCommand):
|
||||
option_list = LabelCommand.option_list + (
|
||||
make_option('--dry-run', '-d', action='store_true', dest='dry_run',
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import socket
|
||||
|
||||
from django.http import HttpResponseBadRequest
|
||||
|
||||
tor_bl = (
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
|
||||
from django.db import models
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
@ -66,4 +67,4 @@ class Migration(SchemaMigration):
|
|||
}
|
||||
}
|
||||
|
||||
complete_apps = ['dpaste']
|
||||
complete_apps = ['dpaste']
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
|
||||
from django.db import models
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
@ -53,4 +54,4 @@ class Migration(SchemaMigration):
|
|||
}
|
||||
}
|
||||
|
||||
complete_apps = ['dpaste']
|
||||
complete_apps = ['dpaste']
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
|
||||
from django.db import models
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
@ -36,4 +37,4 @@ class Migration(SchemaMigration):
|
|||
}
|
||||
}
|
||||
|
||||
complete_apps = ['dpaste']
|
||||
complete_apps = ['dpaste']
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
|
||||
from django.db import models
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
@ -46,4 +47,4 @@ class Migration(SchemaMigration):
|
|||
}
|
||||
}
|
||||
|
||||
complete_apps = ['dpaste']
|
||||
complete_apps = ['dpaste']
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
|
||||
from django.db import models
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
@ -46,4 +47,4 @@ class Migration(SchemaMigration):
|
|||
}
|
||||
}
|
||||
|
||||
complete_apps = ['dpaste']
|
||||
complete_apps = ['dpaste']
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
|
||||
from django.db import models
|
||||
from south.db import db
|
||||
from south.v2 import SchemaMigration
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Migration(SchemaMigration):
|
||||
|
@ -36,4 +37,4 @@ class Migration(SchemaMigration):
|
|||
}
|
||||
}
|
||||
|
||||
complete_apps = ['dpaste']
|
||||
complete_apps = ['dpaste']
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
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
|
||||
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()
|
||||
ONETIME_LIMIT = getattr(settings, 'DPASTE_ONETIME_LIMIT', 2)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from dpaste.settings import *
|
||||
from .settings import *
|
||||
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = DEBUG
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from django.template import Library
|
||||
from dpaste.highlight import pygmentize
|
||||
|
||||
from ..highlight import pygmentize
|
||||
|
||||
register = Library()
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.test.client import Client
|
||||
from django.test import TestCase
|
||||
from django.test.client import Client
|
||||
|
||||
from ..models import Snippet
|
||||
from ..highlight import PLAIN_CODE
|
||||
from ..models import Snippet
|
||||
|
||||
|
||||
class SnippetAPITestCase(TestCase):
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@ from datetime import timedelta
|
|||
|
||||
from django.core import management
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.test.client import Client
|
||||
from django.test import TestCase
|
||||
from django.test.client import Client
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from ..models import Snippet
|
||||
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):
|
||||
|
@ -377,7 +377,7 @@ class SnippetTestCase(TestCase):
|
|||
def test_highlighting(self):
|
||||
# You can pass any lexer to the pygmentize function and it will
|
||||
# never fail loudly.
|
||||
from dpaste.highlight import pygmentize
|
||||
from ..highlight import pygmentize
|
||||
pygmentize('code', lexer_name='python')
|
||||
pygmentize('code', lexer_name='doesnotexist')
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.conf.urls import url, patterns
|
||||
from django.conf import settings
|
||||
from django.conf.urls import patterns, url
|
||||
|
||||
L = getattr(settings, 'DPASTE_SLUG_LENGTH', 4)
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf.urls import url, patterns
|
||||
from django.conf.urls import patterns, url
|
||||
|
||||
from ..views import snippet_api
|
||||
|
||||
urlpatterns = patterns('',
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
import datetime
|
||||
import difflib
|
||||
import requests
|
||||
import json
|
||||
|
||||
from django.shortcuts import (render_to_response, get_object_or_404)
|
||||
from django.template.context import RequestContext
|
||||
from django.http import (Http404, HttpResponseRedirect, HttpResponseBadRequest,
|
||||
HttpResponse)
|
||||
import requests
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.db.models import Count
|
||||
from django.views.defaults import (page_not_found as django_page_not_found,
|
||||
server_error as django_server_error)
|
||||
from django.http import (Http404, HttpResponse, HttpResponseBadRequest,
|
||||
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.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.util import ClassNotFound
|
||||
|
||||
from dpaste.forms import SnippetForm, get_expire_values, EXPIRE_CHOICES
|
||||
from dpaste.models import Snippet, ONETIME_LIMIT
|
||||
from dpaste.highlight import (LEXER_DEFAULT, LEXER_KEYS, LEXER_WORDWRAP,
|
||||
LEXER_LIST, PLAIN_CODE)
|
||||
from .forms import EXPIRE_CHOICES, get_expire_values, SnippetForm
|
||||
from .highlight import (LEXER_DEFAULT, LEXER_KEYS, LEXER_LIST,
|
||||
LEXER_WORDWRAP, PLAIN_CODE)
|
||||
from .models import ONETIME_LIMIT, Snippet
|
||||
|
||||
template_globals = {
|
||||
'site_name': getattr(settings, 'DPASTE_SITE_NAME', 'dpaste.de'),
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
if not settings.configured:
|
||||
|
|
6
setup.py
6
setup.py
|
@ -1,8 +1,10 @@
|
|||
#!/usr/bin/env python
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.test import test as TestCommand
|
||||
from sys import exit
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
|
||||
class Tox(TestCommand):
|
||||
def finalize_options(self):
|
||||
TestCommand.finalize_options(self)
|
||||
|
|
Loading…
Reference in a new issue