PEP8 compliancy

This commit is contained in:
Raphael Michel
2015-02-08 18:45:13 +01:00
parent 2c3a9713a1
commit 5b16eeb8f4
5 changed files with 31 additions and 26 deletions

View File

@@ -105,7 +105,7 @@ LOCALE_PATHS = (
'locale',
)
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _ # NOQA
LANGUAGES = (
('de', _('German')),
('en', _('English')),
@@ -154,6 +154,6 @@ DEFAULT_CURRENCY = 'EUR'
INTERNAL_IPS = ('127.0.0.1', '::1')
try:
from local_settings import *
from local_settings import * # NOQA
except ImportError:
pass

View File

@@ -10,5 +10,5 @@ https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pretix.settings")
from django.core.wsgi import get_wsgi_application
from django.core.wsgi import get_wsgi_application # NOQA
application = get_wsgi_application()

View File

@@ -34,7 +34,8 @@ class VariationDict(dict):
the PropertyValue id's, sorted by the Property id's and is therefore
unique among one item.
"""
order_key = lambda i: i[0]
def order_key(i):
i[0]
return ",".join((
str(v[1].pk) for v in sorted(self.relevant_items(), key=order_key)
))

View File

@@ -166,18 +166,20 @@ class VariationsFieldRenderer(forms.widgets.CheckboxFieldRenderer):
prop2 = properties[1]
prop2v = list(prop2.values.current.all())
# Given an iterable of PropertyValue objects, this will return a
# list of their primary keys, ordered by the primary keys of the
# properties they belong to EXCEPT the value for the property prop2.
# We'll see later why we need this.
selector = lambda values: [
v.identity for v in sorted(values, key=lambda v: v.prop.identity)
if v.prop.identity != prop2.identity
]
def selector(values):
# Given an iterable of PropertyValue objects, this will return a
# list of their primary keys, ordered by the primary keys of the
# properties they belong to EXCEPT the value for the property prop2.
# We'll see later why we need this.
return [
v.identity for v in sorted(values, key=lambda v: v.prop.identity)
if v.prop.identity != prop2.identity
]
# Given a list of variations, this will sort them by their position
# on the x-axis
sort = lambda v: v[prop2.identity].identity
def sort(v):
# Given a list of variations, this will sort them by their position
# on the x-axis
return v[prop2.identity].identity
# We now iterate over the cartesian product of all the other
# properties which are NOT on the axes of the grid because we

View File

@@ -752,18 +752,20 @@ class ItemVariations(ItemDetailMixin, EventPermissionRequiredMixin, TemplateView
# prop2 is the property on all the grid's x-axes
prop2 = self.properties[1]
# Given an iterable of PropertyValue objects, this will return a
# list of their primary keys, ordered by the primary keys of the
# properties they belong to EXCEPT the value for the property prop2.
# We'll see later why we need this.
selector = lambda values: [
v.identity for v in sorted(values, key=lambda v: v.prop.identity)
if v.prop.identity != prop2.identity
]
def selector(values):
# Given an iterable of PropertyValue objects, this will return a
# list of their primary keys, ordered by the primary keys of the
# properties they belong to EXCEPT the value for the property prop2.
# We'll see later why we need this.
return [
v.identity for v in sorted(values, key=lambda v: v.prop.identity)
if v.prop.identity != prop2.identity
]
# Given a list of variations, this will sort them by their position
# on the x-axis
sort = lambda v: v[prop2.identity].identity
def sort(v):
# Given a list of variations, this will sort them by their position
# on the x-axis
return v[prop2.identity].identity
# We now iterate over the cartesian product of all the other
# properties which are NOT on the axes of the grid because we