diff --git a/.coafile b/.coafile index d59fca0..d3a3a0e 100644 --- a/.coafile +++ b/.coafile @@ -5,4 +5,4 @@ language = python bears = PEP8Bear,PyLintBear,PyUnusedCodeBear use_spaces = True pylint_cli_options = --load-plugins pylint_django -pylint_disable = E1101,R0201,R0901,R0903 +#pylint_disable = E1101,R0201,R0901,R0903 diff --git a/Makefile b/Makefile index 42ecf89..c34d859 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ all: cleanup migrate testserver venv: $(VENV_PATH)/bin/activate $(VENV_PATH)/bin/activate: - @test -d $(VENV_PATH) || python3.5 -m venv --clear $(VENV_PATH) + @test -d $(VENV_PATH) || python3 -m venv --clear $(VENV_PATH) dev-requirements: venv ${DEV_REQUIREMENTS} ${PYTHON} -m pip install -qU pip diff --git a/TODO b/TODO index 0607631..e69de29 100644 --- a/TODO +++ b/TODO @@ -1,1072 +0,0 @@ -Executing section Python... - -src/utils/html_cleaner.py -| 7| #·TODO:·Nach·BeatutifulSoup·4·convertieren -| | [NORMAL] PyLintBear (W0511): -| | W0511 - TODO: Nach BeatutifulSoup 4 convertieren -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/content/feeds.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/content/feeds.py -| 7| 7| -| 8| 8| from content.models import Article -| 9| 9| -| 10| |-MAX_ARTICLE_ITEMS = 10 # Maximum count of articles in the news RSS feed. -| 11| |-MAX_COMMENT_ITEMS = 40 # Maximum count of comments in the comments RSS feed. -| | 10|+MAX_ARTICLE_ITEMS = 10 # Maximum count of articles in the news RSS feed. -| | 11|+MAX_COMMENT_ITEMS = 40 # Maximum count of comments in the comments RSS feed. -| 12| 12| -| 13| 13| -| 14| 14| # Start ignoring PyLintBear (R0201) -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/membership/forms.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/membership/forms.py -| 122| 122| def save(self, commit=True): -| 123| 123| """ Create the new User, set him/her inactive, create an acitivation -| 124| 124| request for the user and send him/her an activation email. -| 125| |- -| | 125|+ -| 126| 126| :param commit: commit the SQL and send the email if True -| 127| 127| :return: the created User Object -| 128| 128| """ - -src/membership/forms.py -| 92| ··················) -| | [INFO] PyLintBear (C0330): -| | C0330 - Wrong continued indentation (remove 1 space). - -src/membership/forms.py -| 125| ········ -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/maistar_ranking/views.py -| 17| class·GameForm(EventDetailMixin,·PermissionRequiredMixin,·generic.UpdateView): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/maistar_ranking/views.py -| 77| class·ListPlayerGames(PlayerScore): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/maistar_ranking/views.py -| 90| ····def·get_queryset(self,·**kwargs): -| | [NORMAL] PyLintBear (W0221): -| | W0221 - Parameters differ from overridden 'get_queryset' method - -src/maistar_ranking/views.py -| 90| ····def·get_queryset(self,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'kwargs' - -src/maistar_ranking/views.py -| 93| ········self.season·=·self.kwargs.get('season',·date.today().year) -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'season' defined outside __init__ - -src/maistar_ranking/views.py -| 91| ········self.user·=·get_object_or_404(auth.get_user_model(), -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'user' defined outside __init__ - -src/maistar_ranking/views.py -| 98| class·ListRankings(generic.ListView): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/maistar_ranking/views.py -| 12| from·django.contrib.auth.mixins·import·PermissionRequiredMixin -| | [INFO] PyLintBear (C0412): -| | C0412 - Imports from package django are not grouped - -src/mahjong_ranking/__init__.py -| 1| #·-*-·encoding:·utf-8·-*- -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing module docstring - -src/mahjong_ranking/__init__.py -| 32| logger·=·logging.getLogger('kasu.mahjong_ranking') -| | [INFO] PyLintBear (C0103): -| | C0103 - Invalid constant name "logger" - -src/mahjong_ranking/__init__.py -| 35| def·set_dirty(event=None,·season=None,·user=None,·hanchan_date=None): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing function docstring - -src/mahjong_ranking/__init__.py -| 3| import·logging -| | [INFO] PyLintBear (C0411): -| | C0411 - standard import "import logging" should be placed before "from django.core.cache import cache" - -src/kasu/urls.py -| 17| sitemaps·=·{··#·Ignore·PyLintBear·(C0103) -| | [INFO] PyLintBear (C0103): -| | C0103 - Invalid constant name "sitemaps" -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/maistar_ranking/__init__.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/maistar_ranking/__init__.py -| 1| |-"""A simple ladder ranking system for the game mai-star.""" -| | 1|+"""A simple ladder ranking system for the game mai-star.""" - -src/maistar_ranking/__init__.py -| 1| """A·simple·ladder·ranking·system·for·the·game·mai-star.""" -| | [INFO] PyLintBear (C0304): -| | C0304 - Final newline missing - -src/utils/middleware.py -| 9| ····#·TODO:·Port·to·django·1.10·and·upward -| | [NORMAL] PyLintBear (W0511): -| | W0511 - TODO: Port to django 1.10 and upward - -src/utils/middleware.py -| 7| ····"""This·Middleware·compresses·strips·the·spaces·between·tags,·and·at·the· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/utils/middleware.py -| 14| ········:param·get_response:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/utils/middleware.py -| 22| ········:param·request:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/utils/middleware.py -| 23| ········:return:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/utils/middleware.py -| 17| ········regex·=·">[\s]*<" -| | [NORMAL] PyLintBear (W1401): -| | W1401 - Anomalous backslash in string: '\s'. String constant might be missing an r prefix. - -src/utils/middleware.py -| 17| ········regex·=·">[\s]*<" -| | [NORMAL] PyLintBear (W0612): -| | W0612 - Unused variable 'regex' -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| 7| 7| class HanchanManager(models.Manager): -| 8| 8| """ -| 9| 9| The ObjectManager for models.Hanchan QuerySets. -| 10| |- -| | 10|+ -| 11| 11| It adds many specific filters that makes many queries much easier. -| 12| 12| """ -| 13| 13| use_for_related_fields = True -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| 14| 14| -| 15| 15| def confirmed_hanchans(self, user=None, **filter_args): -| 16| 16| """ Return all valid and confirmed Hanchans. -| 17| |- -| | 17|+ -| 18| 18| :param user: Only return Hanchans where this user participated. -| 19| 19| :param filter_args: To add specific arguments to the Django filter. -| 20| 20| :return: QuerySet Object -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| 39| 39| models.Q(player4=user, player4_dan_points__isnull=False) -| 40| 40| ).filter(confirmed=True, **filter_args) -| 41| 41| queryset = queryset.select_related().order_by('-start') -| 42| |- [ hanchan.get_playerdata(user) for hanchan in queryset ] -| | 42|+ [hanchan.get_playerdata(user) for hanchan in queryset] -| 43| 43| return queryset -| 44| 44| -| 45| 45| def kyu_hanchans(self, user, **filter_args): -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| 57| 57| models.Q(player4=user, player4_kyu_points__isnull=False) -| 58| 58| ).filter(confirmed=True, **filter_args) -| 59| 59| queryset = queryset.select_related().order_by('-start') -| 60| |- [ hanchan.get_playerdata(user) for hanchan in queryset ] -| | 60|+ [hanchan.get_playerdata(user) for hanchan in queryset] -| 61| 61| return queryset -| 62| 62| -| 63| 63| def season_hanchans(self, user=None, season=None): -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/mahjong_ranking/managers.py -| 87| 87| else: -| 88| 88| queryset = queryset.filter(**filter_args) -| 89| 89| queryset = queryset.select_related().order_by('-start') -| 90| |- [ hanchan.get_playerdata(user) for hanchan in queryset ] -| | 90|+ [hanchan.get_playerdata(user) for hanchan in queryset] -| 91| 91| return queryset -| 92| 92| -| 93| 93| def unconfirmed_hanchans(self, user=None, **filter_args): - -src/mahjong_ranking/managers.py -| 9| ····The·ObjectManager·for·models.Hanchan·QuerySets.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 10| ···· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 16| ········"""·Return·all·valid·and·confirmed·Hanchans.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 17| ········ -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 18| ········:param·user:·Only·return·Hanchans·where·this·user·participated.·· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 28| ········"""·Return·all·Hanchans·where·a·specific·user·has·participated·and·had· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 31| ········:param·user:·Only·return·Hanchans·where·this·user·participated.·· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 42| ········[·hanchan.get_playerdata(user)·for·hanchan·in·queryset·] -| | [INFO] PyLintBear (C0326): -| | C0326 - No space allowed after bracket - -src/mahjong_ranking/managers.py -| 42| ········[·hanchan.get_playerdata(user)·for·hanchan·in·queryset·] -| | [INFO] PyLintBear (C0326): -| | C0326 - No space allowed before bracket - -src/mahjong_ranking/managers.py -| 46| ········"""·Return·all·Hanchans·where·a·specific·user·has·participated·and·had· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 49| ········:param·user:·Only·return·Hanchans·where·this·user·participated.·· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 60| ········[·hanchan.get_playerdata(user)·for·hanchan·in·queryset·] -| | [INFO] PyLintBear (C0326): -| | C0326 - No space allowed after bracket - -src/mahjong_ranking/managers.py -| 60| ········[·hanchan.get_playerdata(user)·for·hanchan·in·queryset·] -| | [INFO] PyLintBear (C0326): -| | C0326 - No space allowed before bracket - -src/mahjong_ranking/managers.py -| 66| ········:param·user:·Only·return·Hanchans·where·this·user·participated.·· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 67| ········:param·season:·the·year·of·the·wanted·season,·current·year·if·None.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 68| ········:return:·QuerySet·Object· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 74| ········"""Return·all·Hanchans·where·a·specific·user·has·participated.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 76| ········:param·user:·Return·Hanchans·where·this·user·participated.·· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 90| ········[·hanchan.get_playerdata(user)·for·hanchan·in·queryset·] -| | [INFO] PyLintBear (C0326): -| | C0326 - No space allowed after bracket - -src/mahjong_ranking/managers.py -| 90| ········[·hanchan.get_playerdata(user)·for·hanchan·in·queryset·] -| | [INFO] PyLintBear (C0326): -| | C0326 - No space allowed before bracket - -src/mahjong_ranking/managers.py -| 94| ········"""·Return·all·Hanchans·that·have·been·set·to·unconfirmed.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 96| ········:param·user:·Only·return·Hanchans·where·this·user·participated.·· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 108| ····The·ObjectManager·for·models.SeasonRanking·QuerySets·to·handle·the· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 109| ····Ladderrankings.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 115| ········"""·Returns·the·Rankings·for·the·current·year/season.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 136| ········:param·season:·Season·that·should·be·exported,·current·season·if·empty· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 137| ········:return:·a·list()·of·dict()·objects·suiteable·for·JSON·export.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/mahjong_ranking/managers.py -| 22| ········if·user: -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/mahjong_ranking/managers.py -| 42| ········[·hanchan.get_playerdata(user)·for·hanchan·in·queryset·] -| | [NORMAL] PyLintBear (W0106): -| | W0106 - Expression "[hanchan.get_playerdata(user) for hanchan in queryset]" is assigned to nothing - -src/mahjong_ranking/managers.py -| 60| ········[·hanchan.get_playerdata(user)·for·hanchan·in·queryset·] -| | [NORMAL] PyLintBear (W0106): -| | W0106 - Expression "[hanchan.get_playerdata(user) for hanchan in queryset]" is assigned to nothing - -src/mahjong_ranking/managers.py -| 90| ········[·hanchan.get_playerdata(user)·for·hanchan·in·queryset·] -| | [NORMAL] PyLintBear (W0106): -| | W0106 - Expression "[hanchan.get_playerdata(user) for hanchan in queryset]" is assigned to nothing - -src/mahjong_ranking/managers.py -| 100| ········if·user: -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/membership/views.py -| 117| ········:return:·array·with·the·context·data· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/membership/views.py -| 142| ········"""Overwrite·to·add·googles·recaptcha·ressoruces·to·the· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/membership/views.py -| 144| ········:param·request:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/membership/views.py -| 145| ········:param·args:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/membership/views.py -| 146| ········:param·kwargs:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/membership/views.py -| 80| ········if·self.request.user.has_perm('membership.change_membership'): -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/content/models.py -| 332| def·force_cache_update(sender,·instance,·**kwargs):··#·Ignore·PyLintBear·(W0613) -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'kwargs' -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/membership/models.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/membership/models.py -| 57| 57| @param user: the user that requests activation. -| 58| 58| """ -| 59| 59| salt = str(user.pk * random.random()) + \ -| 60| |- user.registration_date.isoformat() -| | 60|+ user.registration_date.isoformat() -| 61| 61| activation_key = hashlib.sha1(salt.encode()).hexdigest() -| 62| 62| return self.create(user=user, activation_key=activation_key) -| 63| 63| - -src/membership/models.py -| 229| ········:param·args:·passed·through·the·save()·method·from·django·· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/membership/models.py -| 230| ········:param·kwargs:·passed·through·the·save()·method·from·django· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/membership/models.py -| 114| ········if·self.user.is_active: -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/events/models.py -| 269| ········#·TODO:·Eine·vernüftigte·Methode·ohne·viele·Abhängigkeiten·finden·um -| | [NORMAL] PyLintBear (W0511): -| | W0511 - TODO: Eine vernüftigte Methode ohne viele Abhängigkeiten finden um - -src/events/models.py -| 111| ········except: -| | [NORMAL] PyLintBear (W0702): -| | W0702 - No exception type(s) specified - -src/events/models.py -| 120| ····def·get_absolute_url(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 128| ····def·get_eventseries_form_url(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 136| ····def·get_edit_url(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 144| ····def·get_image(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 145| ········if·self.image: -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/events/models.py -| 155| ····def·is_future_event(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 158| ····def·save(self,·**kwargs): -| | [NORMAL] PyLintBear (W0221): -| | W0221 - Parameters differ from overridden 'save' method - -src/events/models.py -| 175| class·Location(models.Model): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/events/models.py -| 211| ····def·address(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 216| class·Photo(models.Model): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/events/models.py -| 268| ····def·rotate(self,·rotate): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 277| ····def·save(self,·**kwargs): -| | [NORMAL] PyLintBear (W0221): -| | W0221 - Parameters differ from overridden 'save' method - -src/events/models.py -| 281| ····def·get_absolute_url(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 288| ····def·next_photo(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 292| ············if·self.event.event_series: -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/events/models.py -| 307| ····def·previous_photo(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/events/models.py -| 311| ············if·self.event.event_series: -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/kasu/wsgi.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/kasu/wsgi.py -| 14| 14| if SOURCE_PATH not in sys.path: -| 15| 15| sys.path.append(SOURCE_PATH) -| 16| 16| -| 17| |-from django.core.wsgi import get_wsgi_application # Ignore PyLintBear (C0413) # Ignore PyLintBear (C0413) -| | 17|+# Ignore PyLintBear (C0413) # Ignore PyLintBear (C0413) -| | 18|+from django.core.wsgi import get_wsgi_application -| 18| 19| -| 19| 20| os.environ['DJANGO_SETTINGS_MODULE'] = 'kasu.settings' -| 20| 21| -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/kasu/wsgi.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/kasu/wsgi.py -| 18| 18| -| 19| 19| os.environ['DJANGO_SETTINGS_MODULE'] = 'kasu.settings' -| 20| 20| -| 21| |-application = get_wsgi_application() # Ignore PyLintBear (C0103) # Ignore PyLintBear (C0103) -| | 21|+# Ignore PyLintBear (C0103) # Ignore PyLintBear (C0103) -| | 22|+application = get_wsgi_application() - -src/kasu/wsgi.py -| 17| from·django.core.wsgi·import·get_wsgi_application··#·Ignore·PyLintBear·(C0413)··#·Ignore·PyLintBear·(C0413) -| | [INFO] PyLintBear (C0301): -| | C0301 - Line too long (107/100) - -src/kasu/wsgi.py -| 17| from·django.core.wsgi·import·get_wsgi_application··#·Ignore·PyLintBear·(C0413)··#·Ignore·PyLintBear·(C0413) -| | [INFO] PyLintBear (C0413): -| | C0413 - Import "from django.core.wsgi import get_wsgi_application" should be placed at the top of the module - -src/kasu/wsgi.py -| 21| application·=·get_wsgi_application()··#·Ignore·PyLintBear·(C0103)··#·Ignore·PyLintBear·(C0103) -| | [INFO] PyLintBear (C0103): -| | C0103 - Invalid constant name "application" -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/content/views.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/content/views.py -| 197| 197| -| 198| 198| def get_object(self, queryset=None): -| 199| 199| """ Get the path from the URL and fetch the corresponding page. -| 200| |- -| | 200|+ -| 201| 201| First get the path wihout fileextentsion leading or trailing slashes, -| 202| 202| then search in the database if such a page exists. -| 203| 203| -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/content/views.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/content/views.py -| 288| 288| -| 289| 289| def get_context_data(self): -| 290| 290| """ Adds recent ariticles and recent comments to the context. -| 291| |- -| | 291|+ -| 292| 292| :return: array() with the context data -| 293| 293| """ -| 294| 294| page = models.Page.objects.get(slug='index') - -src/content/views.py -| 17| ····Since·it·is·only·used·in·edit·forms,·it·extends·the·PermissionRequiredMixin.····· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 163| ········:param·queryset:·Get·the·single·item·from·this·filtered·queryset.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 164| ········:return:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 173| ····"""·Renders·an·Form·to·create·a·new·page·for·users·with·conforming· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 200| ········· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 205| ········:return:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 225| ········:return:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 251| ········"""Get·the·PDF·page·from·the·db·that·equals·the·given·URL.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 254| ········:return:·models.Page·object·or·raise·a·404·if·not·found.· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 291| ········ -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 292| ········:return:·array()·with·the·context·data· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/content/views.py -| 1| import·os -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing module docstring - -src/content/views.py -| 289| ····def·get_context_data(self): -| | [NORMAL] PyLintBear (W0221): -| | W0221 - Parameters differ from overridden 'get_context_data' method - -src/mahjong_ranking/models.py -| 3| #·TODO:·Rankings·archiv·Flag·erstellen,·womit·sie·nicht·mehr·neuberechnet -| | [NORMAL] PyLintBear (W0511): -| | W0511 - TODO: Rankings archiv Flag erstellen, womit sie nicht mehr neuberechnet - -src/mahjong_ranking/models.py -| 394| ····#·TODO:·Komplett·Überabreiten! -| | [NORMAL] PyLintBear (W0511): -| | W0511 - TODO: Komplett Überabreiten! - -src/mahjong_ranking/models.py -| 545| ····#·TODO:·Merkwürdige·Methode·die·zwar·funktioniert·aber·nicht·sehr -| | [NORMAL] PyLintBear (W0511): -| | W0511 - TODO: Merkwürdige Methode die zwar funktioniert aber nicht sehr - -src/mahjong_ranking/models.py -| 222| ········elif·not·(self.event.start·<=·self.start·<=·self.event.end): -| | [INFO] PyLintBear (C0325): -| | C0325 - Unnecessary parens after 'not' keyword - -src/mahjong_ranking/models.py -| 1| #·-*-·encoding:·utf-8·-*- -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing module docstring - -src/mahjong_ranking/models.py -| 19| kyu_dan_rankings·=·set() -| | [INFO] PyLintBear (C0103): -| | C0103 - Invalid constant name "kyu_dan_rankings" - -src/mahjong_ranking/models.py -| 20| ladder_rankings·=·set() -| | [INFO] PyLintBear (C0103): -| | C0103 - Invalid constant name "ladder_rankings" - -src/mahjong_ranking/models.py -| 21| ladder_seasons·=·set() -| | [INFO] PyLintBear (C0103): -| | C0103 - Invalid constant name "ladder_seasons" - -src/mahjong_ranking/models.py -| 42| ····def·get_absolute_url(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/mahjong_ranking/models.py -| 81| class·Hanchan(models.Model): -| | [INFO] PyLintBear (R0902): -| | R0902 - Too many instance attributes (10/7) - -src/mahjong_ranking/models.py -| 270| ····def·get_absolute_url(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/mahjong_ranking/models.py -| 290| ····def·update_playerdata(self,·user,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'kwargs' - -src/mahjong_ranking/models.py -| 304| ····def·player_list(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/mahjong_ranking/models.py -| 321| ····def·save(self,·recalculate=True,·**kwargs): -| | [NORMAL] PyLintBear (W0221): -| | W0221 - Parameters differ from overridden 'save' method - -src/mahjong_ranking/models.py -| 283| ················self.game_score·=·getattr(self,·'%s_game_score'·%·player) -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'game_score' defined outside __init__ - -src/mahjong_ranking/models.py -| 284| ················self.placement·=·getattr(self,·'%s_placement'·%·player) -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'placement' defined outside __init__ - -src/mahjong_ranking/models.py -| 282| ················self.input_score·=·getattr(self,·'%s_input_score'·%·player) -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'input_score' defined outside __init__ - -src/mahjong_ranking/models.py -| 281| ················self.user·=·user -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'user' defined outside __init__ - -src/mahjong_ranking/models.py -| 286| ················self.dan_points·=·getattr(self,·'%s_dan_points'·%·player) -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'dan_points' defined outside __init__ - -src/mahjong_ranking/models.py -| 287| ················self.bonus_points·=·getattr(self,·'%s_bonus_points'·%·player) -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'bonus_points' defined outside __init__ - -src/mahjong_ranking/models.py -| 288| ················self.player_comment·=·getattr(self,·'%s_comment'·%·player) -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'player_comment' defined outside __init__ - -src/mahjong_ranking/models.py -| 285| ················self.kyu_points·=·getattr(self,·'%s_kyu_points'·%·player) -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'kyu_points' defined outside __init__ - -src/mahjong_ranking/models.py -| 330| class·KyuDanRanking(models.Model): -| | [INFO] PyLintBear (R0902): -| | R0902 - Too many instance attributes (8/7) - -src/mahjong_ranking/models.py -| 356| ········if·self.dan_points·is·not·None: -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/mahjong_ranking/models.py -| 431| ····def·get_absolute_url(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/mahjong_ranking/models.py -| 432| ········if·self.dan·or·self.dan_points·>·0: -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/mahjong_ranking/models.py -| 492| ····def·update_hanchan_points(self,·hanchan): -| | [INFO] PyLintBear (R0912): -| | R0912 - Too many branches (18/12) - -src/mahjong_ranking/models.py -| 547| ····def·update_rank(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/mahjong_ranking/models.py -| 574| class·SeasonRanking(models.Model): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/mahjong_ranking/models.py -| 588| ····def·get_absolute_url(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/mahjong_ranking/models.py -| 591| ····def·recalculate(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/mahjong_ranking/models.py -| 618| def·update_ranking(sender,·instance,·**kwargs): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing function docstring - -src/mahjong_ranking/models.py -| 634| ····set_dirty(event=instance.event_id,·user=user.id) -| | [NORMAL] PyLintBear (W0631): -| | W0631 - Using possibly undefined loop variable 'user' - -src/mahjong_ranking/models.py -| 618| def·update_ranking(sender,·instance,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'sender' - -src/mahjong_ranking/models.py -| 618| def·update_ranking(sender,·instance,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'kwargs' - -src/events/forms.py -| 60| EventSeriesFormset·=·forms.inlineformset_factory(··#·Ignore·PyLintBear·(C0103) -| | [INFO] PyLintBear (C0103): -| | C0103 - Invalid constant name "EventSeriesFormset" - -src/maistar_ranking/models.py -| 91| ····def·save(self,·**kwargs): -| | [NORMAL] PyLintBear (W0221): -| | W0221 - Parameters differ from overridden 'save' method - -src/maistar_ranking/models.py -| 195| def·update_maistar_ranking(sender,·instance,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'kwargs' - -src/maistar_ranking/models.py -| 195| def·update_maistar_ranking(sender,·instance,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'sender' -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/utils/tests.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/utils/tests.py -| 44| 44| xxx-xxxx -| 45| 45| ''', -| 46| 46| '' -| 47| |- ) -| | 47|+ ) -| 48| 48| ) -| 49| 49| -| 50| 50| def test_html_cleaner(self): - -src/maistar_ranking/managers.py -| 12| class·GameManager(models.Manager): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/maistar_ranking/managers.py -| 15| ····def·player_games(self,·player,·season=None,·**kwargs): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/maistar_ranking/managers.py -| 28| class·LadderManager(models.Manager): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/maistar_ranking/managers.py -| 58| ····def·get_seasons(self): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/kasu/local_settings.py -| 9| specific·to·the·current·deployment.·e.g.·usernames,·passwords,·pathnames,· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/kasu/local_settings.py -| 16| logger·=·logging.getLogger(__name__) -| | [INFO] PyLintBear (C0103): -| | C0103 - Invalid constant name "logger" - -src/kasu/local_settings.py -| 29| ····import·rosetta -| | [NORMAL] PyLintBear (W0611): -| | W0611 - Unused import rosetta - -src/kasu/local_settings.py -| 36| ····import·debug_toolbar -| | [NORMAL] PyLintBear (W0611): -| | W0611 - Unused import debug_toolbar - -src/events/views.py -| 90| ····def·get(self,·request,·*args,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'kwargs' - -src/events/views.py -| 90| ····def·get(self,·request,·*args,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'args' - -src/events/views.py -| 90| ····def·get(self,·request,·*args,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'request' - -src/events/views.py -| 121| ········if·request.POST.get('rotate')·and·request.user.has_perm( -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/events/views.py -| 153| class·EventPhotoUpload(mixins.EventDetailMixin,·generic.FormView): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/events/views.py -| 167| ····def·post(self,·*args,·**kwargs): -| | [NORMAL] PyLintBear (W0221): -| | W0221 - Parameters differ from overridden 'post' method - -src/events/views.py -| 186| class·EventSeriesForm(mixins.EventDetailMixin,·PermissionRequiredMixin, -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/events/views.py -| 204| class·UpcomingEvents(generic.ListView): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring -| | [NORMAL] PEP8Bear: -| | The code does not comply to PEP8. -|----| | /srv/home/xeniac/Workspace/kasu/src/utils/massmailer.py -| |++++| /srv/home/xeniac/Workspace/kasu/src/utils/massmailer.py -| 68| 68| -| 69| 69| def set_header(self, name, value): -| 70| 70| """Add or modify an E-Mail Header to the Messages -| 71| |- -| | 71|+ -| 72| 72| :param name: The Header Name that should be added -| 73| 73| :param value: THe Header Value that shoud be added or set -| 74| 74| """ - -src/utils/massmailer.py -| 71| ········ -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/utils/massmailer.py -| 81| ········:return:· -| | [INFO] PyLintBear (C0303): -| | C0303 - Trailing whitespace - -src/utils/massmailer.py -| 48| ················LOGGER.debug('Adding·%s·as·Recipient'·%·recipient) -| | [NORMAL] PyLintBear (W1201): -| | W1201 - Specify string format arguments as logging function parameters - -src/utils/massmailer.py -| 77| ····def·send(self,·recipients=set()): -| | [NORMAL] PyLintBear (W0102): -| | W0102 - Dangerous default value set() (builtins.set) as argument - -src/utils/massmailer.py -| 84| ········if·len(mail_queue)·==·0: -| | [INFO] PyLintBear (C1801): -| | C1801 - Do not use `len(SEQUENCE)` as condition value - -src/utils/massmailer.py -| 100| ····················LOGGER.info("Mail·sent·successful·to:·%s"·%·mail.to) -| | [NORMAL] PyLintBear (W1201): -| | W1201 - Specify string format arguments as logging function parameters - -src/mahjong_ranking/views.py -| 151| ············:3] -| | [INFO] PyLintBear (C0330): -| | C0330 - Wrong hanging indentation (add 4 spaces). - -src/mahjong_ranking/views.py -| 1| #·-*-·encoding:·utf-8·-*- -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing module docstring - -src/mahjong_ranking/views.py -| 18| kyu_dan_order·=·{ -| | [INFO] PyLintBear (C0103): -| | C0103 - Invalid constant name "kyu_dan_order" - -src/mahjong_ranking/views.py -| 68| ········if·self.request.user.has_perm('mahjong_ranking.change_hanchan'): -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/mahjong_ranking/views.py -| 91| ········if·self.kwargs.get('hanchan'): -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/mahjong_ranking/views.py -| 97| ········if·self.kwargs.get('hanchan'): -| | [INFO] PyLintBear (R1705): -| | R1705 - Unnecessary "else" after "return" - -src/mahjong_ranking/views.py -| 138| class·MahjongMixin(object): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/mahjong_ranking/views.py -| 139| ····def·get_context_data(self,·**kwargs): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing method docstring - -src/mahjong_ranking/views.py -| 175| class·SeasonRankingList(MahjongMixin,·generic.ListView): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/mahjong_ranking/views.py -| 189| class·PlayerScore(LoginRequiredMixin,·generic.ListView): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/mahjong_ranking/views.py -| 195| ············self.user·=·user_model.objects.get( -| | [NORMAL] PyLintBear (W0201): -| | W0201 - Attribute 'user' defined outside __init__ - -src/mahjong_ranking/views.py -| 220| class·PlayerDanScore(PlayerScore): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/mahjong_ranking/views.py -| 227| class·PlayerInvalidScore(PlayerScore): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/mahjong_ranking/views.py -| 234| class·PlayerKyuScore(PlayerScore): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/mahjong_ranking/views.py -| 241| class·PlayerLadderScore(PlayerScore): -| | [INFO] PyLintBear (C0111): -| | C0111 - Missing class docstring - -src/mahjong_ranking/views.py -| 253| ····def·get_queryset(self,·**kwargs): -| | [NORMAL] PyLintBear (W0221): -| | W0221 - Parameters differ from overridden 'get_queryset' method - -src/mahjong_ranking/views.py -| 253| ····def·get_queryset(self,·**kwargs): -| | [NORMAL] PyLintBear (W0613): -| | W0613 - Unused argument 'kwargs' -Executing section cli... diff --git a/src/content/context_processors.py b/src/content/context_processors.py index 3826ba0..85f1d9a 100644 --- a/src/content/context_processors.py +++ b/src/content/context_processors.py @@ -5,6 +5,7 @@ from django.core.cache import cache from . import models from utils import STATUS_PUBLISHED + def content_menus(request): """ Generate the menu tree and add these info to the template context. diff --git a/src/content/locale/de/LC_MESSAGES/django.po b/src/content/locale/de/LC_MESSAGES/django.po index d5170cb..12a2e5b 100644 --- a/src/content/locale/de/LC_MESSAGES/django.po +++ b/src/content/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: kasu.content\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-12 16:27+0100\n" +"POT-Creation-Date: 2019-12-13 23:38+0100\n" "PO-Revision-Date: 2018-01-12 15:25+0105\n" "Last-Translator: b'Christian Berg '\n" "Language-Team: Deutsch <>\n" diff --git a/src/events/locale/de/LC_MESSAGES/django.po b/src/events/locale/de/LC_MESSAGES/django.po index 373a5de..ffac328 100644 --- a/src/events/locale/de/LC_MESSAGES/django.po +++ b/src/events/locale/de/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: kasu.events\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-12 16:27+0100\n" +"POT-Creation-Date: 2019-12-13 23:38+0100\n" "PO-Revision-Date: 2018-01-12 15:25+0105\n" "Last-Translator: b'Christian Berg '\n" "Language-Team: Kasu \n" diff --git a/src/events/views.py b/src/events/views.py index 058221e..77b5692 100644 --- a/src/events/views.py +++ b/src/events/views.py @@ -5,7 +5,8 @@ from django.contrib.auth import get_user_model from django.contrib.auth.mixins import PermissionRequiredMixin from django.urls import reverse from django.db.models import Q -from django.http import HttpResponse, Http404 +from django.http import Http404 +from django.http import HttpResponse from django.shortcuts import redirect from django.utils import timezone from django.utils.translation import ugettext as _ diff --git a/src/kasu/locale/de/LC_MESSAGES/django.po b/src/kasu/locale/de/LC_MESSAGES/django.po index b37b2e5..db6208a 100644 --- a/src/kasu/locale/de/LC_MESSAGES/django.po +++ b/src/kasu/locale/de/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: kasu.utils\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-12 16:27+0100\n" +"POT-Creation-Date: 2019-12-13 23:38+0100\n" "PO-Revision-Date: 2018-12-30 11:14+0105\n" "Last-Translator: b' '\n" "Language-Team: Kasu \n" diff --git a/src/kasu/wsgi.py b/src/kasu/wsgi.py index 347aa37..ccb4367 100644 --- a/src/kasu/wsgi.py +++ b/src/kasu/wsgi.py @@ -14,8 +14,8 @@ if VENV_PATH not in sys.path: if SOURCE_PATH not in sys.path: sys.path.append(SOURCE_PATH) -from django.core.wsgi import get_wsgi_application # Ignore PyLintBear (C0413) # Ignore PyLintBear (C0413) +from django.core.wsgi import get_wsgi_application os.environ['DJANGO_SETTINGS_MODULE'] = 'kasu.settings' -application = get_wsgi_application() # Ignore PyLintBear (C0103) # Ignore PyLintBear (C0103) +application = get_wsgi_application() diff --git a/src/kasu/xlsx.py b/src/kasu/xlsx.py index 4a26a88..7bf83b8 100644 --- a/src/kasu/xlsx.py +++ b/src/kasu/xlsx.py @@ -80,7 +80,8 @@ class Workbook(object): :rtype: object """ self.workbook = openpyxl.Workbook() - [self.workbook.add_named_style(style) for style in XLSX_STYLES.values()] + [self.workbook.add_named_style(style) + for style in XLSX_STYLES.values()] [self.workbook.remove(sheet) for sheet in self.workbook.worksheets] def generate_sheet(self, title, columns_settings, object_list, @@ -135,7 +136,8 @@ class Workbook(object): # write table footer for column, settings in enumerate(columns_settings, 1): - cell = ws.cell(column=column, row=row, value=settings.get('footer')) + cell = ws.cell(column=column, row=row, + value=settings.get('footer')) cell.style = settings['style'] row += 1 diff --git a/src/mahjong_ranking/admin.py b/src/mahjong_ranking/admin.py index 7db8813..1deb307 100644 --- a/src/mahjong_ranking/admin.py +++ b/src/mahjong_ranking/admin.py @@ -21,6 +21,8 @@ def recalculate(modeladmin, request, queryset): # Ignore PyLintBear (W0613) for ladder_ranking in queryset: set_dirty(user=ladder_ranking.user_id, season=ladder_ranking.season) + + recalculate.short_description = _("Recalculate") diff --git a/src/mahjong_ranking/locale/de/LC_MESSAGES/django.po b/src/mahjong_ranking/locale/de/LC_MESSAGES/django.po index dc1a29a..2d9f6dc 100644 --- a/src/mahjong_ranking/locale/de/LC_MESSAGES/django.po +++ b/src/mahjong_ranking/locale/de/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: kasu.mahjong_ranking\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-12 16:27+0100\n" +"POT-Creation-Date: 2019-12-13 23:38+0100\n" "PO-Revision-Date: 2018-05-08 00:20+0105\n" "Last-Translator: b'Christian Berg '\n" "Language-Team: Kasu \n" diff --git a/src/mahjong_ranking/management/commands/resetdanranking.py b/src/mahjong_ranking/management/commands/resetdanranking.py index c01274e..ad5e5cc 100644 --- a/src/mahjong_ranking/management/commands/resetdanranking.py +++ b/src/mahjong_ranking/management/commands/resetdanranking.py @@ -3,11 +3,13 @@ Rest all dan points to 0 at a given date. """ from django.core.management.base import BaseCommand -from datetime import date, datetime, time +from datetime import datetime +from datetime import time from mahjong_ranking import models from django.utils.dateparse import parse_date from django.utils import timezone + class Command(BaseCommand): """ Recalculate all Kyu/Dan Rankings """ @@ -17,12 +19,13 @@ class Command(BaseCommand): parser.add_argument('reset_date', type=parse_date) def handle(self, *args, **options): - legacy_attrs = [ key for key in models.KyuDanRanking.__dict__.keys() - if key.startswith('legacy') ] + legacy_attrs = [key for key in models.KyuDanRanking.__dict__.keys() + if key.startswith('legacy')] legacy_attrs.remove('legacy_date') reset_date = timezone.make_aware(datetime.combine( options.get('reset_date'), time(23, 59, 59))) - models.KyuDanRanking.objects.update(until=reset_date, force_recalc=True) + models.KyuDanRanking.objects.update( + until=reset_date, force_recalc=True) for ranking in models.KyuDanRanking.objects.filter(dan__gt=0): print(ranking) ranking.dan = 1 diff --git a/src/mahjong_ranking/managers.py b/src/mahjong_ranking/managers.py index 674f734..f2bc49b 100644 --- a/src/mahjong_ranking/managers.py +++ b/src/mahjong_ranking/managers.py @@ -8,14 +8,14 @@ from django.conf import settings class HanchanManager(models.Manager): """ The ObjectManager for models.Hanchan QuerySets. - + It adds many specific filters that makes many queries much easier. """ use_for_related_fields = True def confirmed(self, user=None, since=None, until=None, **filter_args): """ Return all valid and confirmed Hanchans. - + :param user: Only return Hanchans where this user participated. :param since: only return Hanchans played since the given datetime :param until: only return Hanchans played until the given datetime @@ -32,7 +32,7 @@ class HanchanManager(models.Manager): hanchans = hanchans.filter(start__lte=until) return hanchans - def dan_hanchans(self, user, since = None, **filter_args): + def dan_hanchans(self, user, since=None, **filter_args): """ Return all Hanchans where a specific user has participated and had gain dan points and make his gamestats availabale. @@ -53,7 +53,7 @@ class HanchanManager(models.Manager): [hanchan.get_playerdata(user) for hanchan in queryset] return queryset - def kyu_hanchans(self, user, since = None, **filter_args): + def kyu_hanchans(self, user, since=None, **filter_args): """ Return all Hanchans where a specific user has participated and had gain kyū points and make his gamestats availabale. diff --git a/src/mahjong_ranking/middleware.py b/src/mahjong_ranking/middleware.py index c93909a..25e533a 100644 --- a/src/mahjong_ranking/middleware.py +++ b/src/mahjong_ranking/middleware.py @@ -5,6 +5,7 @@ from mahjong_ranking import models from . import LOGGER from . import LOGGER + class DenormalizationUpdateMiddleware: """To recalculate everything in the queues at the end of a POST request.""" diff --git a/src/mahjong_ranking/models.py b/src/mahjong_ranking/models.py index 8e4a6d1..47fa9c9 100644 --- a/src/mahjong_ranking/models.py +++ b/src/mahjong_ranking/models.py @@ -29,7 +29,8 @@ class EventRanking(models.Model): Sie beschränken sich aber auf einen Event und werden nur dann angestossen, wenn der Event als Turnier markiert wurde. """ - user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT) + user = models.ForeignKey(settings.AUTH_USER_MODEL, + on_delete=models.PROTECT) event = models.ForeignKey(Event, on_delete=models.CASCADE) placement = models.PositiveIntegerField(blank=True, null=True) avg_placement = models.FloatField(default=4) @@ -428,7 +429,8 @@ class KyuDanRanking(models.Model): ).order_by('-start') last_hanchan_this_event = hanchans_this_event[0] # Das braucht nur am Ende eines Turnieres gemacht werden. - if hanchan != last_hanchan_this_event: return False + if hanchan != last_hanchan_this_event: + return False event_ranking = EventRanking.objects.get( user=self.user, event=hanchan.event @@ -603,7 +605,8 @@ class KyuDanRanking(models.Model): class SeasonRanking(models.Model): - user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT) + user = models.ForeignKey(settings.AUTH_USER_MODEL, + on_delete=models.PROTECT) season = models.PositiveSmallIntegerField(_('Season')) placement = models.PositiveIntegerField(blank=True, null=True) avg_placement = models.FloatField(blank=True, null=True) diff --git a/src/mahjong_ranking/urls.py b/src/mahjong_ranking/urls.py index 4158f5c..d71eab9 100644 --- a/src/mahjong_ranking/urls.py +++ b/src/mahjong_ranking/urls.py @@ -36,4 +36,3 @@ urlpatterns = [ # Ignore PyLintBear (C0103) url(r'^mahjong/(?P[\+\-][a-z_]+)/$', views.KyuDanRankingList.as_view(), name="kyudanranking-list"), ] - diff --git a/src/mahjong_ranking/views.py b/src/mahjong_ranking/views.py index 14ed205..14f92c9 100644 --- a/src/mahjong_ranking/views.py +++ b/src/mahjong_ranking/views.py @@ -125,7 +125,7 @@ class EventHanchanForm(EventDetailMixin, PermissionRequiredMixin, """Display a Formset to add and Edit Hanchans of the specific Event.""" permission_required = 'mahjong_ranking.add_hanchan' template_name = 'mahjong_ranking/eventhanchan_form.html' - model=models.Hanchan + model = models.Hanchan def get_context_data(self, **kwargs): self.event = models.Event.objects.get(pk=self.kwargs['event']) @@ -160,7 +160,6 @@ class EventHanchanForm(EventDetailMixin, PermissionRequiredMixin, return self.render_to_response(context) - class EventHanchanList(EventDetailMixin, generic.ListView): "List all hanchans played on a given event." model = models.Hanchan diff --git a/src/maistar_ranking/__init__.py b/src/maistar_ranking/__init__.py index 2fcd221..423e4bb 100644 --- a/src/maistar_ranking/__init__.py +++ b/src/maistar_ranking/__init__.py @@ -1 +1 @@ -"""A simple ladder ranking system for the game mai-star.""" \ No newline at end of file +"""A simple ladder ranking system for the game mai-star.""" diff --git a/src/maistar_ranking/locale/de/LC_MESSAGES/django.po b/src/maistar_ranking/locale/de/LC_MESSAGES/django.po index d8f07cb..2de3422 100644 --- a/src/maistar_ranking/locale/de/LC_MESSAGES/django.po +++ b/src/maistar_ranking/locale/de/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: kasu.mahjong_ranking\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-12 16:27+0100\n" +"POT-Creation-Date: 2019-12-13 23:38+0100\n" "PO-Revision-Date: 2016-09-28 00:24+0200\n" "Last-Translator: Christian Berg \n" "Language-Team: Kasu \n" diff --git a/src/maistar_ranking/models.py b/src/maistar_ranking/models.py index 3e65c3b..60cbbd8 100644 --- a/src/maistar_ranking/models.py +++ b/src/maistar_ranking/models.py @@ -149,7 +149,8 @@ class Game(models.Model): class Ranking(models.Model): """the player scores in the ladder for one season. """ - user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT) + user = models.ForeignKey(settings.AUTH_USER_MODEL, + on_delete=models.PROTECT) season = models.PositiveSmallIntegerField(_("Season")) placement = models.PositiveIntegerField(blank=True, null=True) avg_placement = models.PositiveSmallIntegerField(blank=True, null=True) diff --git a/src/maistar_ranking/sitemaps.py b/src/maistar_ranking/sitemaps.py index 1f7883f..9fb58bd 100644 --- a/src/maistar_ranking/sitemaps.py +++ b/src/maistar_ranking/sitemaps.py @@ -5,7 +5,6 @@ from django.urls import reverse from events.models import Event - class MaistarGamesSitemap(GenericSitemap): @staticmethod def items(): diff --git a/src/membership/admin.py b/src/membership/admin.py index 70a8135..3137735 100644 --- a/src/membership/admin.py +++ b/src/membership/admin.py @@ -51,17 +51,22 @@ def clear_personal_data(modeladmin, request, queryset): raise PermissionDenied for membership in queryset: if membership.membership == False: - [ setattr(membership, fieldname, None) for fieldname in membership.nullable_personal_data ] - [ setattr(membership, fieldname, "") for fieldname in membership.blankable_personal_data ] + [setattr(membership, fieldname, None) + for fieldname in membership.nullable_personal_data] + [setattr(membership, fieldname, "") + for fieldname in membership.blankable_personal_data] membership.is_active = False membership.confirmed = False membership.membership = False membership.save() cleared_memberships += 1 else: - modeladmin.message_user(request, _("Can't remove personal data from active member %s.") % membership.username, messages.ERROR) + modeladmin.message_user(request, _( + "Can't remove personal data from active member %s.") % membership.username, messages.ERROR) if cleared_memberships > 0: - modeladmin.message_user(request, _("Cleared %d personal data profiles.") % cleared_memberships, messages.INFO) + modeladmin.message_user(request, _( + "Cleared %d personal data profiles.") % cleared_memberships, messages.INFO) + clear_personal_data.short_description = _("Clear personal Data") diff --git a/src/membership/forms.py b/src/membership/forms.py index 76691e4..fec4a2e 100644 --- a/src/membership/forms.py +++ b/src/membership/forms.py @@ -3,7 +3,7 @@ Created on 03.10.2011 @author: Christian """ -from datetime import date, timedelta +from datetime import date from captcha.fields import ReCaptchaField from django import forms from django.conf import settings @@ -68,13 +68,13 @@ class RegistrationForm(MembershipForm): label=_('Privacy policy'), help_text=_( 'I have read and understood the privacy policy') % - Page.objects.get(slug='privacypolicy').get_absolute_url()) + Page.objects.get(slug='privacypolicy').get_absolute_url()) membership = forms.BooleanField( label=_('Membership'), help_text=_( 'Yes, I confirm that I am in agreement with the ' 'statutes and would like to become a member.') % - Page.objects.get(slug='statutes').get_absolute_url()) + Page.objects.get(slug='statutes').get_absolute_url()) recaptcha = ReCaptchaField() diff --git a/src/membership/locale/de/LC_MESSAGES/django.po b/src/membership/locale/de/LC_MESSAGES/django.po index 23b2d93..f1dbb8c 100644 --- a/src/membership/locale/de/LC_MESSAGES/django.po +++ b/src/membership/locale/de/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: kasu.membership\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-12 16:27+0100\n" +"POT-Creation-Date: 2019-12-13 23:38+0100\n" "PO-Revision-Date: 2018-05-08 00:19+0105\n" "Last-Translator: b'Christian Berg '\n" "Language-Team: Kasu \n" diff --git a/src/membership/models.py b/src/membership/models.py index 6aa9669..e0f9762 100644 --- a/src/membership/models.py +++ b/src/membership/models.py @@ -207,9 +207,9 @@ class Membership(AbstractUser): ) nullable_personal_data = ( - 'gender', 'birthday', 'telephone', 'street_name', 'post_code', 'city') + 'gender', 'birthday', 'telephone', 'street_name', 'post_code', 'city') blankable_personal_data = ( - 'email', 'password', 'first_name', 'last_name', 'website',) + 'email', 'password', 'first_name', 'last_name', 'website',) class Meta(object): """To manage object ordering and dispalynames on the admin interface.""" diff --git a/src/membership/urls.py b/src/membership/urls.py index 4547ae8..e88a2e4 100644 --- a/src/membership/urls.py +++ b/src/membership/urls.py @@ -9,7 +9,7 @@ from django.conf.urls import url from . import views urlpatterns = [ - url(r'^$',views.MembershipDetail.as_view()), + url(r'^$', views.MembershipDetail.as_view()), url(r'^activate/(?P[\d\w]+)/$', views.ActivateRegistration.as_view(), name='membership-activate-registration'), diff --git a/src/utils/locale/de/LC_MESSAGES/django.po b/src/utils/locale/de/LC_MESSAGES/django.po index 5aa9285..571502a 100644 --- a/src/utils/locale/de/LC_MESSAGES/django.po +++ b/src/utils/locale/de/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: kasu.utils\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-12 16:27+0100\n" +"POT-Creation-Date: 2019-12-13 23:38+0100\n" "PO-Revision-Date: 2016-09-28 00:24+0200\n" "Last-Translator: Christian Berg \n" "Language-Team: Kasu \n" diff --git a/src/utils/massmailer.py b/src/utils/massmailer.py index c0e517b..35d7c19 100644 --- a/src/utils/massmailer.py +++ b/src/utils/massmailer.py @@ -67,7 +67,7 @@ class MassMailer(object): def set_header(self, name, value): """Add or modify an E-Mail Header to the Messages - + :param name: The Header Name that should be added :param value: THe Header Value that shoud be added or set """ diff --git a/src/utils/middleware.py b/src/utils/middleware.py index 847ed5e..a679095 100644 --- a/src/utils/middleware.py +++ b/src/utils/middleware.py @@ -13,7 +13,6 @@ class CompressHtmlMiddleware: :param get_response: """ self.get_response = get_response - regex = ">[\s]*<" def __call__(self, request): """ @@ -24,7 +23,6 @@ class CompressHtmlMiddleware: # Code to be executed for each request before # the view (and later middleware) are called. - response = self.get_response(request) if 'text/html' in response['Content-Type']: response.content = strip_spaces_between_tags( diff --git a/src/utils/tests.py b/src/utils/tests.py index 6cc1cbf..4ae920f 100644 --- a/src/utils/tests.py +++ b/src/utils/tests.py @@ -44,7 +44,7 @@ class HtmlTestCase(unittest.TestCase): xxx-xxxx ''', '' - ) + ) ) def test_html_cleaner(self):