isort 5.0 config/docs (#1736)

This commit is contained in:
Felix Rindt
2020-07-30 17:57:26 +02:00
committed by GitHub
parent 355dd4463b
commit 77f76195c8
24 changed files with 60 additions and 37 deletions

View File

@@ -4,6 +4,9 @@ from django.conf import settings
from django.utils import translation
from django.utils.formats import date_format, number_format
from django.utils.translation import gettext
from pretix.base.templatetags.money import money_filter
from i18nfield.fields import ( # noqa
I18nCharField, I18nTextarea, I18nTextField, I18nTextInput,
)
@@ -12,8 +15,6 @@ from i18nfield.forms import I18nFormField # noqa
from i18nfield.strings import LazyI18nString # noqa
from i18nfield.utils import I18nJSONEncoder # noqa
from pretix.base.templatetags.money import money_filter
class LazyDate:
def __init__(self, value):

View File

@@ -4,6 +4,7 @@ from django.db import migrations
from pretix.base.channels import get_all_sales_channels
def set_sales_channels(apps, schema_editor):
# We now allow restricting some mails to certain sales channels
# The default is changing from all channels to "web" only

View File

@@ -173,7 +173,7 @@ class User(AbstractBaseUser, PermissionsMixin, LoggingMixin):
return self.email
def send_security_notice(self, messages, email=None):
from pretix.base.services.mail import mail, SendMailException
from pretix.base.services.mail import SendMailException, mail
try:
with language(self.locale):

View File

@@ -48,14 +48,15 @@ class LoggingMixin:
:param data: Any JSON-serializable object
:param user: The user performing the action (optional)
"""
from .log import LogEntry
from .event import Event
from .devices import Device
from pretix.api.models import OAuthAccessToken, OAuthApplication
from .organizer import TeamAPIToken
from pretix.api.webhooks import get_all_webhook_events, notify_webhooks
from ..notifications import get_all_notification_types
from ..services.notifications import notify
from pretix.api.webhooks import get_all_webhook_events, notify_webhooks
from .devices import Device
from .event import Event
from .log import LogEntry
from .organizer import TeamAPIToken
event = None
if isinstance(self, Event):

View File

@@ -48,7 +48,7 @@ class CheckinList(LoggedModel):
@property
def positions(self):
from . import OrderPosition, Order
from . import Order, OrderPosition
qs = OrderPosition.objects.filter(
order__event=self.event,

View File

@@ -415,7 +415,7 @@ class Event(EventMixin, LoggedModel):
return super().presale_has_ended
def delete_all_orders(self, really=False):
from .orders import OrderRefund, OrderPayment, OrderPosition, OrderFee
from .orders import OrderFee, OrderPayment, OrderPosition, OrderRefund
if not really:
raise TypeError("Pass really=True as a parameter.")
@@ -502,8 +502,10 @@ class Event(EventMixin, LoggedModel):
), tz)
def copy_data_from(self, other):
from . import ItemAddOn, ItemCategory, Item, Question, Quota, ItemMetaValue
from ..signals import event_copy_data
from . import (
Item, ItemAddOn, ItemCategory, ItemMetaValue, Question, Quota,
)
self.plugins = other.plugins
self.is_public = other.is_public
@@ -1183,8 +1185,8 @@ class RequiredAction(models.Model):
created = not self.pk
super().save(*args, **kwargs)
if created:
from .log import LogEntry
from ..services.notifications import notify
from .log import LogEntry
logentry = LogEntry.objects.create(
content_object=self,

View File

@@ -75,7 +75,10 @@ class LogEntry(models.Model):
@cached_property
def display_object(self):
from . import Order, Voucher, Quota, Item, ItemCategory, Question, Event, TaxRule, SubEvent
from . import (
Event, Item, ItemCategory, Order, Question, Quota, SubEvent,
TaxRule, Voucher,
)
try:
if self.content_type.model_class() is Event:

View File

@@ -209,7 +209,7 @@ class Order(LockModel, LoggedModel):
return self.full_code
def gracefully_delete(self, user=None, auth=None):
from . import Voucher, GiftCard, GiftCardTransaction
from . import GiftCard, GiftCardTransaction, Voucher
if not self.testmode:
raise TypeError("Only test mode orders can be deleted.")
@@ -838,7 +838,9 @@ class Order(LockModel, LoggedModel):
only be attached for this position and child positions, the link will only point to the
position and the attendee email will be used if available.
"""
from pretix.base.services.mail import SendMailException, mail, render_mail, TolerantDict
from pretix.base.services.mail import (
SendMailException, TolerantDict, mail, render_mail,
)
if not self.email:
return
@@ -1421,7 +1423,9 @@ class OrderPayment(models.Model):
:type mail_text: str
:raises Quota.QuotaExceededException: if the quota is exceeded and ``force`` is ``False``
"""
from pretix.base.services.invoices import generate_invoice, invoice_qualified
from pretix.base.services.invoices import (
generate_invoice, invoice_qualified,
)
with transaction.atomic():
locked_instance = OrderPayment.objects.select_for_update().get(pk=self.pk)
@@ -2066,7 +2070,9 @@ class OrderPosition(AbstractPosition):
:param sender: Custom email sender.
:param attach_tickets: Attach tickets of this order, if they are existing and ready to download
"""
from pretix.base.services.mail import SendMailException, mail, render_mail
from pretix.base.services.mail import (
SendMailException, mail, render_mail,
)
if not self.attendee_email:
return

View File

@@ -113,7 +113,7 @@ class Organizer(LoggedModel):
), tz)
def allow_delete(self):
from . import Order, Invoice
from . import Invoice, Order
return (
not Order.objects.filter(event__organizer=self).exists() and
not Invoice.objects.filter(event__organizer=self).exists() and

View File

@@ -163,7 +163,7 @@ class Seat(models.Model):
@classmethod
def annotated(cls, qs, event_id, subevent, ignore_voucher_id=None, minimal_distance=0,
ignore_order_id=None, ignore_cart_id=None, distance_only_within_row=False):
from . import Order, OrderPosition, Voucher, CartPosition
from . import CartPosition, Order, OrderPosition, Voucher
vqs = Voucher.objects.filter(
event_id=event_id,

View File

@@ -544,7 +544,7 @@ class Renderer:
with open(os.path.join(d, 'out.pdf'), 'rb') as f:
return BytesIO(f.read())
else:
from PyPDF2 import PdfFileWriter, PdfFileReader
from PyPDF2 import PdfFileReader, PdfFileWriter
buffer.seek(0)
new_pdf = PdfFileReader(buffer)
output = PdfFileWriter()