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

View File

@@ -10,5 +10,5 @@ https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
import os import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pretix.settings") 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() 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 the PropertyValue id's, sorted by the Property id's and is therefore
unique among one item. unique among one item.
""" """
order_key = lambda i: i[0] def order_key(i):
i[0]
return ",".join(( return ",".join((
str(v[1].pk) for v in sorted(self.relevant_items(), key=order_key) 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] prop2 = properties[1]
prop2v = list(prop2.values.current.all()) prop2v = list(prop2.values.current.all())
# Given an iterable of PropertyValue objects, this will return a def selector(values):
# list of their primary keys, ordered by the primary keys of the # Given an iterable of PropertyValue objects, this will return a
# properties they belong to EXCEPT the value for the property prop2. # list of their primary keys, ordered by the primary keys of the
# We'll see later why we need this. # properties they belong to EXCEPT the value for the property prop2.
selector = lambda values: [ # We'll see later why we need this.
v.identity for v in sorted(values, key=lambda v: v.prop.identity) return [
if v.prop.identity != prop2.identity 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 def sort(v):
# on the x-axis # Given a list of variations, this will sort them by their position
sort = lambda v: v[prop2.identity].identity # on the x-axis
return v[prop2.identity].identity
# We now iterate over the cartesian product of all the other # We now iterate over the cartesian product of all the other
# properties which are NOT on the axes of the grid because we # 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 is the property on all the grid's x-axes
prop2 = self.properties[1] prop2 = self.properties[1]
# Given an iterable of PropertyValue objects, this will return a def selector(values):
# list of their primary keys, ordered by the primary keys of the # Given an iterable of PropertyValue objects, this will return a
# properties they belong to EXCEPT the value for the property prop2. # list of their primary keys, ordered by the primary keys of the
# We'll see later why we need this. # properties they belong to EXCEPT the value for the property prop2.
selector = lambda values: [ # We'll see later why we need this.
v.identity for v in sorted(values, key=lambda v: v.prop.identity) return [
if v.prop.identity != prop2.identity 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 def sort(v):
# on the x-axis # Given a list of variations, this will sort them by their position
sort = lambda v: v[prop2.identity].identity # on the x-axis
return v[prop2.identity].identity
# We now iterate over the cartesian product of all the other # We now iterate over the cartesian product of all the other
# properties which are NOT on the axes of the grid because we # properties which are NOT on the axes of the grid because we