From 25fff77be52979e2c791c6c478797591b5ca698e Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Fri, 13 Mar 2015 00:07:14 +0100 Subject: [PATCH] Django's new URLconfig style allows us to no longer ignore PEP8s error E128 --- .travis.yml | 2 +- doc/development/style.rst | 10 +++------- src/pretix/presale/views/__init__.py | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 21d647d2c..7ab7743ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ install: - pip install -q -r src/requirements.txt before_script: - cd src - - flake8 --ignore=E123,E128,F403,F401,N802,C901,W503 . + - flake8 --ignore=E123,F403,F401,N802,C901,W503 . - python manage.py check - python manage.py validate script: diff --git a/doc/development/style.rst b/doc/development/style.rst index 41a88ece3..4d5060a1a 100644 --- a/doc/development/style.rst +++ b/doc/development/style.rst @@ -8,15 +8,13 @@ Python code Use `flake8`_ to check for conformance problems. The project includes a setup.cfg with a default configuration for flake8 that excludes migrations and other non-relevant - code parts. It also silences a few checks, ``N802`` (function names should be lowercase) and - ``E128`` (continuation line under-indented for visual indent) as well as increasing the - maximum line length to more than 79 characters. **However** you should still name all your - functions lowercase [#f1]_ and keep your lines short when possible. [#f2]_ + code parts. It also silences a few checks, e.g. ``N802`` (function names should be lowercase) + and increases the maximum line length to more than 79 characters. **However** you should + still name all your functions lowercase [#f1]_ and keep your lines short when possible. * Our build server will reject all code violating other flake8 checks than the following: * E123: closing bracket does not match indentation of opening bracket’s line - * E128: continuation line under-indented for visual indent * F403: ``from module import *`` used; unable to detect undefined names * F401: module imported but unused * N802: function names should be lowercase @@ -55,5 +53,3 @@ LESS stylesheets .. _Django Coding Style: https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/ .. _mixins: http://lesscss.org/features/#mixins-feature .. [#f1] But Python's very own ``unittest`` module forces us to use ``setUp`` as a method name... -.. [#f2] The underindentation-thing is silenced because PEP8-conforming indentation looks very bad - in the ``urls.py`` modules. diff --git a/src/pretix/presale/views/__init__.py b/src/pretix/presale/views/__init__.py index 39bea6948..0982fdc8c 100644 --- a/src/pretix/presale/views/__init__.py +++ b/src/pretix/presale/views/__init__.py @@ -76,7 +76,7 @@ class CartDisplayMixin: # Django is unable to join related models in a .values() query def keyfunc(pos): if answers and ((pos.item.admission and self.request.event.settings.attendee_names_asked == 'True') - or pos.item.questions.all()): + or pos.item.questions.all()): return pos.id, "", "", "" return "", pos.item_id, pos.variation_id, pos.price