core -- Fix flake8 errors

This commit is contained in:
Aurélien Delobelle 2018-10-06 12:47:19 +02:00
parent fdd2b35289
commit 402b544393
13 changed files with 16 additions and 23 deletions

View file

@ -1,7 +1,5 @@
import random import random
from django.db.models import Max
class Algorithm(object): class Algorithm(object):

View file

@ -9,7 +9,9 @@ from bda.models import SpectacleRevente
class Command(BaseCommand): class Command(BaseCommand):
help = "Envoie les mails de notification et effectue " "les tirages au sort des reventes" help = (
"Envoie les mails de notification et effectue les tirages au sort des reventes"
)
leave_locale_alone = True leave_locale_alone = True
def handle(self, *args, **options): def handle(self, *args, **options):

View file

@ -11,7 +11,10 @@ from bda.models import Spectacle
class Command(BaseCommand): class Command(BaseCommand):
help = "Envoie les mails de rappel des spectacles dont la date " "approche.\nNe renvoie pas les mails déjà envoyés." help = (
"Envoie les mails de rappel des spectacles dont la date approche.\n"
"Ne renvoie pas les mails déjà envoyés."
)
leave_locale_alone = True leave_locale_alone = True
def handle(self, *args, **options): def handle(self, *args, **options):

View file

@ -98,7 +98,7 @@ class Spectacle(models.Model):
""" """
try: try:
return self.image.url return self.image.url
except: except Exception:
return None return None
def send_rappel(self): def send_rappel(self):

View file

@ -1,7 +1,7 @@
from datetime import timedelta from datetime import timedelta
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.test import Client, TestCase from django.test import TestCase
from django.utils import timezone from django.utils import timezone
from bda.models import ( from bda.models import (

View file

@ -6,7 +6,7 @@ class GestioncofConfig(AppConfig):
verbose_name = "Gestion des adhérents du COF" verbose_name = "Gestion des adhérents du COF"
def ready(self): def ready(self):
from . import signals from . import signals # noqa
self.register_config() self.register_config()

View file

@ -5,7 +5,7 @@ def is_cof(user):
try: try:
profile = user.profile profile = user.profile
return profile.is_cof return profile.is_cof
except: except Exception:
return False return False
@ -16,7 +16,7 @@ def is_buro(user):
try: try:
profile = user.profile profile = user.profile
return profile.is_buro return profile.is_buro
except: except Exception:
return False return False

View file

@ -2,8 +2,6 @@ from django.conf import settings
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django_cas_ng.backends import CASBackend from django_cas_ng.backends import CASBackend
from gestioncof.models import CofProfile
class COFCASBackend(CASBackend): class COFCASBackend(CASBackend):
def clean_username(self, username): def clean_username(self, username):

View file

@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

View file

@ -7,4 +7,4 @@ class KFetCMSAppConfig(AppConfig):
verbose_name = "CMS K-Fêt" verbose_name = "CMS K-Fêt"
def ready(self): def ready(self):
from . import hooks from . import hooks # noqa

View file

@ -219,7 +219,7 @@ class CheckoutStatementCreateForm(forms.ModelForm):
or self.cleaned_data["balance_500"] is None or self.cleaned_data["balance_500"] is None
): ):
raise ValidationError( raise ValidationError(
"Y'a un problème. Si tu comptes la caisse, mets au moins des 0 stp (et t'as pas idée de comment c'est long de vérifier que t'as mis des valeurs de partout...)" "Y'a un problème. Si tu comptes la caisse, mets au moins des 0 stp."
) )
super().clean() super().clean()

View file

@ -8,7 +8,6 @@ from django.db import models, transaction
from django.db.models import F from django.db.models import F
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.utils.six.moves import reduce
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from gestioncof.models import CofProfile from gestioncof.models import CofProfile
@ -164,7 +163,7 @@ class Account(models.Model):
pattern = re.compile("^[^a-z]{3}$") pattern = re.compile("^[^a-z]{3}$")
data["is_valid"] = pattern.match(trigramme) and True or False data["is_valid"] = pattern.match(trigramme) and True or False
try: try:
account = Account.objects.get(trigramme=trigramme) Account.objects.get(trigramme=trigramme)
except Account.DoesNotExist: except Account.DoesNotExist:
data["is_free"] = True data["is_free"] = True
return data return data

View file

@ -2,7 +2,6 @@ import ast
import heapq import heapq
import statistics import statistics
from collections import defaultdict from collections import defaultdict
from datetime import timedelta
from decimal import Decimal from decimal import Decimal
from urllib.parse import urlencode from urllib.parse import urlencode
@ -10,12 +9,10 @@ from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.auth.models import Permission, User from django.contrib.auth.models import Permission, User
from django.contrib.messages.views import SuccessMessageMixin from django.contrib.messages.views import SuccessMessageMixin
from django.core.cache import cache
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse, reverse_lazy from django.core.urlresolvers import reverse, reverse_lazy
from django.db import transaction from django.db import transaction
from django.db.models import Count, F, Prefetch, Sum from django.db.models import Count, F, Prefetch, Sum
from django.db.models.functions import Coalesce
from django.forms import formset_factory from django.forms import formset_factory
from django.http import Http404, JsonResponse from django.http import Http404, JsonResponse
from django.shortcuts import get_object_or_404, redirect, render from django.shortcuts import get_object_or_404, redirect, render
@ -30,7 +27,6 @@ from kfet import consumers
from kfet.config import kfet_config from kfet.config import kfet_config
from kfet.decorators import teamkfet_required from kfet.decorators import teamkfet_required
from kfet.forms import ( from kfet.forms import (
AccountBalanceForm,
AccountForm, AccountForm,
AccountNegativeForm, AccountNegativeForm,
AccountNoTriForm, AccountNoTriForm,
@ -80,7 +76,7 @@ from kfet.models import (
Transfer, Transfer,
TransferGroup, TransferGroup,
) )
from kfet.statistic import ScaleMixin, WeekScale, last_stats_manifest, tot_ventes from kfet.statistic import ScaleMixin, WeekScale, last_stats_manifest
from .auth.views import ( # noqa from .auth.views import ( # noqa
AccountGroupCreate, AccountGroupCreate,