Sort Python imports with isort

This commit is contained in:
Ben Sturmfels 2023-10-20 09:52:39 +11:00
parent b7e2ce2a4d
commit 47a30a750a
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
45 changed files with 106 additions and 54 deletions

View file

@ -1,6 +1,7 @@
# Generated by Django 1.11.29 on 2021-12-06 22:37 # Generated by Django 1.11.29 on 2021-12-06 22:37
import datetime import datetime
from django.db import migrations, models from django.db import migrations, models
import django_countries.fields import django_countries.fields

View file

@ -1,8 +1,9 @@
# Generated by Django 1.11.29 on 2021-12-06 22:49 # Generated by Django 1.11.29 on 2021-12-06 22:49
from django.db import migrations, models
import uuid import uuid
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -1,8 +1,10 @@
# Generated by Django 1.11.29 on 2023-01-27 06:02 # Generated by Django 1.11.29 on 2023-01-27 06:02
from django.db import migrations, models from django.db import migrations, models
from ..models import validate_mutiple_urls from ..models import validate_mutiple_urls
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [

View file

@ -2,7 +2,6 @@ from django.conf.urls import url
from .views import AssignmentCreateView, AssignmentThanksView from .views import AssignmentCreateView, AssignmentThanksView
urlpatterns = [ urlpatterns = [
url(r'^$', AssignmentCreateView.as_view(), name='assignement-add'), url(r'^$', AssignmentCreateView.as_view(), name='assignement-add'),
url(r'^(?P<pk>[\w-]+)/$', AssignmentThanksView.as_view(), name='assignment-thanks'), url(r'^(?P<pk>[\w-]+)/$', AssignmentThanksView.as_view(), name='assignment-thanks'),

View file

@ -6,6 +6,7 @@ from django.views.generic.edit import CreateView
from .forms import AssignmentForm from .forms import AssignmentForm
from .models import Assignment from .models import Assignment
class AssignmentCreateView(CreateView): class AssignmentCreateView(CreateView):
"""Show a form for the initial copyright assignment.""" """Show a form for the initial copyright assignment."""

View file

@ -1,6 +1,6 @@
from django.contrib import admin from django.contrib import admin
from .models import EntryTag, Entry from .models import Entry, EntryTag
class EntryTagAdmin(admin.ModelAdmin): class EntryTagAdmin(admin.ModelAdmin):

View file

@ -1,7 +1,7 @@
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.db import models
from django.conf import settings from django.conf import settings
from django.db import models
from ... import bsoup from ... import bsoup
from ..staff.models import Person from ..staff.models import Person

View file

@ -1,10 +1,18 @@
from datetime import datetime from datetime import datetime
from django.conf.urls import url, include from django.conf.urls import include, url
from .models import Entry, EntryTag
from ..staff.models import Person from ..staff.models import Person
from .views import last_name, BlogYearArchiveView, BlogMonthArchiveView, BlogDayArchiveView, BlogDateDetailView, custom_index, query from .models import Entry, EntryTag
from .views import (
BlogDateDetailView,
BlogDayArchiveView,
BlogMonthArchiveView,
BlogYearArchiveView,
custom_index,
last_name,
query,
)
extra_context = {} extra_context = {}

View file

@ -1,13 +1,18 @@
from datetime import datetime from datetime import datetime
from functools import reduce from functools import reduce
from django.views.generic import ListView from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.views.generic.dates import YearArchiveView, MonthArchiveView, DayArchiveView, DateDetailView
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.shortcuts import get_object_or_404, render from django.shortcuts import get_object_or_404, render
from django.views.generic import ListView
from django.views.generic.dates import (
DateDetailView,
DayArchiveView,
MonthArchiveView,
YearArchiveView,
)
from .models import Entry, EntryTag
from ..staff.models import Person from ..staff.models import Person
from .models import Entry, EntryTag
def OR_filter(field_name, objs): def OR_filter(field_name, objs):

View file

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class ContactEntry(models.Model): class ContactEntry(models.Model):
"""Conservancy contact system """Conservancy contact system

View file

@ -1,4 +1,4 @@
from django.conf.urls import patterns, url, include from django.conf.urls import include, patterns, url
urlpatterns = patterns('conservancy.apps.contacts.views', urlpatterns = patterns('conservancy.apps.contacts.views',
(r'^/?$', 'subscribe'), (r'^/?$', 'subscribe'),

View file

@ -1,6 +1,6 @@
from django.shortcuts import render
from django import forms from django import forms
from django.forms import ModelForm from django.forms import ModelForm
from django.shortcuts import render
from .models import ContactEntry from .models import ContactEntry

View file

@ -1,4 +1,4 @@
from django.conf.urls import url, include from django.conf.urls import include, url
from . import views as cpatch_views from . import views as cpatch_views

View file

@ -1,6 +1,6 @@
from django.contrib import admin from django.contrib import admin
from .models import EventTag, Event, EventMedia from .models import Event, EventMedia, EventTag
admin.site.register(EventTag) admin.site.register(EventTag)

View file

@ -1,4 +1,4 @@
from django.conf.urls import patterns, url, include from django.conf.urls import include, patterns, url
from .models import Event from .models import Event

View file

@ -1,8 +1,8 @@
# from django.views.generic.list_detail import object_list # from django.views.generic.list_detail import object_list
from django.shortcuts import render
from django.http import Http404, HttpResponse
from django.template import loader
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404, HttpResponse
from django.shortcuts import render
from django.template import loader
from .models import Event from .models import Event

View file

@ -1,8 +1,9 @@
# Generated by Django 1.11.29 on 2023-01-27 06:19 # Generated by Django 1.11.29 on 2023-01-27 06:19
from django.db import migrations, models
import uuid import uuid
from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -2,7 +2,6 @@ from django.conf.urls import url
from .views import CommunityTrackProposalCreateView, CommunityTrackProposalThanksView from .views import CommunityTrackProposalCreateView, CommunityTrackProposalThanksView
urlpatterns = [ urlpatterns = [
url(r'^community-tracks/$', CommunityTrackProposalCreateView.as_view(), name='fossy-add'), url(r'^community-tracks/$', CommunityTrackProposalCreateView.as_view(), name='fossy-add'),
url(r'^(?P<pk>[\w-]+)/$', CommunityTrackProposalThanksView.as_view(), name='fossy-thanks'), url(r'^(?P<pk>[\w-]+)/$', CommunityTrackProposalThanksView.as_view(), name='fossy-thanks'),

View file

@ -1,6 +1,6 @@
from django.contrib import admin from django.contrib import admin
from .models import PressRelease, ExternalArticleTag, ExternalArticle from .models import ExternalArticle, ExternalArticleTag, PressRelease
class PressReleaseAdmin(admin.ModelAdmin): class PressReleaseAdmin(admin.ModelAdmin):

View file

@ -1,12 +1,12 @@
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.db import models
from django.conf import settings from django.conf import settings
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.db import models
from ... import bsoup from ... import bsoup
from ..staff.models import Person
from ..events.models import Event from ..events.models import Event
from ..staff.models import Person
class PressRelease(models.Model, bsoup.SoupModelMixin): class PressRelease(models.Model, bsoup.SoupModelMixin):

View file

@ -1,5 +1,6 @@
from datetime import datetime, timedelta
from django import template from django import template
from datetime import timedelta, datetime
register = template.Library() register = template.Library()

View file

@ -1,4 +1,5 @@
from django import template from django import template
register = template.Library() register = template.Library()
@register.filter @register.filter

View file

@ -1,4 +1,5 @@
from django import template from django import template
register = template.Library() register = template.Library()
@register.filter @register.filter

View file

@ -17,11 +17,17 @@
# along with this program in a file in the toplevel directory called # along with this program in a file in the toplevel directory called
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>. # "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
from django.conf.urls import url, include
from django.conf import settings from django.conf import settings
from django.conf.urls import include, url
from .models import PressRelease, ExternalArticle from .models import ExternalArticle, PressRelease
from .views import NewsYearArchiveView, NewsMonthArchiveView, NewsDayArchiveView, NewsDateDetailView, listing from .views import (
NewsDateDetailView,
NewsDayArchiveView,
NewsMonthArchiveView,
NewsYearArchiveView,
listing,
)
info_dict = { info_dict = {
'queryset': PressRelease.objects.all().filter(sites__id__exact=settings.SITE_ID), 'queryset': PressRelease.objects.all().filter(sites__id__exact=settings.SITE_ID),

View file

@ -1,14 +1,18 @@
from datetime import datetime from datetime import datetime
from django.views.generic import ListView from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.shortcuts import render
from django.views.generic.dates import YearArchiveView, MonthArchiveView, DayArchiveView, DateDetailView
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render
from django.views.generic import ListView
from django.views.generic.dates import (
DateDetailView,
DayArchiveView,
MonthArchiveView,
YearArchiveView,
)
from .models import ExternalArticle
from .models import PressRelease
from ..events.models import Event from ..events.models import Event
from .models import ExternalArticle, PressRelease
class NewsListView(ListView): class NewsListView(ListView):

View file

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class Person(models.Model): class Person(models.Model):
"""Staff members """Staff members

View file

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class SummitRegistration(models.Model): class SummitRegistration(models.Model):
"""Form fields for summit registrants""" """Form fields for summit registrants"""

View file

@ -1,4 +1,4 @@
from django.conf.urls import patterns, url, include from django.conf.urls import include, patterns, url
urlpatterns = patterns('conservancy.apps.summit_registration.views', urlpatterns = patterns('conservancy.apps.summit_registration.views',
(r'^/?$', 'register'), (r'^/?$', 'register'),

View file

@ -1,6 +1,7 @@
from django.shortcuts import render
from django import forms
from conervancy.apps.summit_registration.models import SummitRegistration from conervancy.apps.summit_registration.models import SummitRegistration
from django import forms
from django.shortcuts import render
def register(request): def register(request):
"""Summit registration form view """Summit registration form view

View file

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class Supporter(models.Model): class Supporter(models.Model):
"""Conservancy Supporter listing""" """Conservancy Supporter listing"""

View file

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class EarthLocation(models.Model): class EarthLocation(models.Model):
"""Represents latitude and longitude, with a label""" """Represents latitude and longitude, with a label"""

View file

@ -5,6 +5,7 @@ import re
import bs4 import bs4
import bs4.element import bs4.element
class BeautifulSoup(bs4.BeautifulSoup): class BeautifulSoup(bs4.BeautifulSoup):
"""A wrapper of the original BeautifulSoup class, with convenience methods added.""" """A wrapper of the original BeautifulSoup class, with convenience methods added."""

View file

@ -13,9 +13,9 @@ import tempfile
try: try:
import markdown import markdown
from markdown.extensions import tables as mdx_tables
from markdown.extensions import sane_lists as mdx_sane_lists from markdown.extensions import sane_lists as mdx_sane_lists
from markdown.extensions import smarty as mdx_smarty from markdown.extensions import smarty as mdx_smarty
from markdown.extensions import tables as mdx_tables
from markdown.extensions import toc as mdx_toc from markdown.extensions import toc as mdx_toc
markdown_import_success = True markdown_import_success = True
except ImportError: except ImportError:

View file

@ -1,5 +1,6 @@
import mimetypes import mimetypes
import os.path import os.path
from django.http import HttpResponse from django.http import HttpResponse
from django.template.response import TemplateResponse from django.template.response import TemplateResponse

View file

@ -17,7 +17,7 @@
# along with this program in a file in the toplevel directory called # along with this program in a file in the toplevel directory called
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>. # "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
from django.conf.urls import url, include from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
from . import feeds, frontpage, sponsors from . import feeds, frontpage, sponsors

View file

@ -21,6 +21,7 @@
# so we just bypass it altogether and set the relevant variable here. # so we just bypass it altogether and set the relevant variable here.
# See deployment documentation for more info. # See deployment documentation for more info.
from os import environ from os import environ
environ["DJANGO_SETTINGS_MODULE"] = 'conservancy_ssl.settings' environ["DJANGO_SETTINGS_MODULE"] = 'conservancy_ssl.settings'
environ["CANONICAL_HOSTNAME"] = 'sfconservancy.org' environ["CANONICAL_HOSTNAME"] = 'sfconservancy.org'

View file

@ -2,6 +2,7 @@
# so we just bypass it altogether and set the relevant variable here. # so we just bypass it altogether and set the relevant variable here.
# See deployment documentation for more info. # See deployment documentation for more info.
from os import environ from os import environ
environ["DJANGO_SETTINGS_MODULE"] = 'conservancy.settings' environ["DJANGO_SETTINGS_MODULE"] = 'conservancy.settings'
environ["CANONICAL_HOSTNAME"] = 'sfconservancy.org' environ["CANONICAL_HOSTNAME"] = 'sfconservancy.org'

View file

@ -1,5 +1,6 @@
from mod_python import apache from mod_python import apache
# 404 should do NOTHING so apache can handle it. This view is referenced # 404 should do NOTHING so apache can handle it. This view is referenced
# in sflc.urls # in sflc.urls
def view404(request): def view404(request):
@ -30,6 +31,8 @@ def outputfilter(filter):
if s is None: if s is None:
filter.close() filter.close()
from django.core.handlers.modpython import *
# This is unreferenced from this file, but it must be imported to # This is unreferenced from this file, but it must be imported to
# enable template inheritance in the outputfilter! # enable template inheritance in the outputfilter!
import django.template.loader import django.template.loader
@ -37,7 +40,6 @@ import django.template.loader
# And now we override a few things in the module # And now we override a few things in the module
# django.core.handlers.modpython # django.core.handlers.modpython
from django.core.handlers.modpython import *
del handler del handler
class ModPythonRequest(ModPythonRequest): class ModPythonRequest(ModPythonRequest):

View file

@ -18,7 +18,8 @@
# #
from django.contrib import admin from django.contrib import admin
from .models import CastTag, Cast from .models import Cast, CastTag
class CastTagAdmin(admin.ModelAdmin): class CastTagAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('label',)} prepopulated_fields = {'slug': ('label',)}

View file

@ -21,11 +21,11 @@ from datetime import datetime
import itertools import itertools
import operator import operator
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.syndication.views import add_domain, Feed
from django.utils.feedgenerator import Rss201rev2Feed
from django.shortcuts import render
from django.conf import settings from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from django.contrib.syndication.views import Feed, add_domain
from django.shortcuts import render
from django.utils.feedgenerator import Rss201rev2Feed
from .models import Cast from .models import Cast

View file

@ -17,11 +17,13 @@
# along with this program in a file in the toplevel directory called # along with this program in a file in the toplevel directory called
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>. # "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
from django.shortcuts import render
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.shortcuts import render
from .models import Cast from .models import Cast
def view(request): def view(request):
"""Cast front page view """Cast front page view
Performs all object queries necessary to render the front page. Performs all object queries necessary to render the front page.

View file

@ -16,11 +16,12 @@
# along with this program in a file in the toplevel directory called # along with this program in a file in the toplevel directory called
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>. # "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
# #
from django.db import models
from django.conf import settings
from django.urls import reverse
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.conf import settings
from django.db import models
from django.urls import reverse
class CastTag(models.Model): class CastTag(models.Model):
"""Tagging for casts""" """Tagging for casts"""

View file

@ -1,5 +1,6 @@
from datetime import datetime, timedelta
from django import template from django import template
from datetime import timedelta, datetime
register = template.Library() register = template.Library()

View file

@ -18,13 +18,18 @@
# "AGPLv3". If not, see <http://www.gnu.org/licenses/>. # "AGPLv3". If not, see <http://www.gnu.org/licenses/>.
from django.conf import settings from django.conf import settings
from django.conf.urls import url, include from django.conf.urls import include, url
from django.contrib import admin from django.contrib import admin
from django.contrib.syndication.views import Feed from django.contrib.syndication.views import Feed
from django.views.generic.dates import DateDetailView, DayArchiveView, MonthArchiveView, YearArchiveView from django.views.generic.dates import (
DateDetailView,
DayArchiveView,
MonthArchiveView,
YearArchiveView,
)
from . import frontpage from . import frontpage
from .feeds import feed_dict, view, Mp3CastFeed, OggCastFeed from .feeds import Mp3CastFeed, OggCastFeed, feed_dict, view
from .models import Cast, CastTag from .models import Cast, CastTag
from .views import custom_index, query from .views import custom_index, query

View file

@ -19,8 +19,8 @@
from datetime import datetime from datetime import datetime
from functools import reduce from functools import reduce
from django.views.generic.list import ListView
from django.shortcuts import get_object_or_404, render from django.shortcuts import get_object_or_404, render
from django.views.generic.list import ListView
from .models import Cast, CastTag from .models import Cast, CastTag