1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-02-06 11:33:00 +00:00

More linting

This commit is contained in:
Yohann D'ANELLO 2020-11-03 18:16:36 +01:00
parent c35fb4e996
commit fa368a399a
6 changed files with 19 additions and 18 deletions

View File

@ -562,10 +562,10 @@ class TestStudentParticipation(TestCase):
reverse("participation:add_question", args=(self.team.participation.pk,)), 302, 200) reverse("participation:add_question", args=(self.team.participation.pk,)), 302, 200)
response = self.client.get(reverse("participation:update_question", args=(self.question.pk,))) response = self.client.get(reverse("participation:update_question", args=(self.question.pk,)))
self.assertRedirects(response, reverse("login") + "?next=" + self.assertRedirects(response, reverse("login") + "?next=" +
reverse("participation:delete_question", args=(self.question.pk,)), 302, 200) reverse("participation:update_question", args=(self.question.pk,)), 302, 200)
response = self.client.get(reverse("participation:add_question", args=(self.question.pk,))) response = self.client.get(reverse("participation:delete_question", args=(self.question.pk,)))
self.assertRedirects(response, reverse("login") + "?next=" + self.assertRedirects(response, reverse("login") + "?next=" +
reverse("participation:add_question", args=(self.question.pk,)), 302, 200) reverse("participation:delete_question", args=(self.question.pk,)), 302, 200)
def test_current_phase(self): def test_current_phase(self):
""" """

View File

@ -1,8 +1,12 @@
import os import os
from typing import Tuple from typing import Any, Dict, Optional, Tuple, Union
from asgiref.sync import async_to_sync from asgiref.sync import async_to_sync
from nio import * from nio import AsyncClient, DataProvider, ProfileSetAvatarError, ProfileSetAvatarResponse, \
ProfileSetDisplayNameError, ProfileSetDisplayNameResponse, RoomCreateError, RoomCreateResponse, \
RoomInviteError, RoomInviteResponse, RoomKickError, RoomKickResponse, RoomPreset, \
RoomPutStateError, RoomPutStateResponse, RoomResolveAliasResponse, RoomVisibility, TransferMonitor, \
UploadError, UploadResponse
class Matrix: class Matrix:
@ -263,7 +267,7 @@ class Matrix:
@classmethod @classmethod
@async_to_sync @async_to_sync
async def kick(cls, room_id: str, user_id: str, reason: str = None) -> Union[RoomKickResponse, RoomInviteError]: async def kick(cls, room_id: str, user_id: str, reason: str = None) -> Union[RoomKickResponse, RoomKickError]:
""" """
Kick a user from a room, or withdraw their invitation. Kick a user from a room, or withdraw their invitation.
@ -370,4 +374,3 @@ class FakeMatrixClient:
async def func(*_, **_2): async def func(*_, **_2):
return None return None
return func return func

View File

@ -1,8 +1,7 @@
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User
from threading import local from threading import local
from django.conf import settings
from django.contrib.auth.models import AnonymousUser, User
from django.contrib.sessions.backends.db import SessionStore from django.contrib.sessions.backends.db import SessionStore
USER_ATTR_NAME = getattr(settings, 'LOCAL_USER_ATTR_NAME', '_current_user') USER_ATTR_NAME = getattr(settings, 'LOCAL_USER_ATTR_NAME', '_current_user')

View File

@ -89,8 +89,7 @@ LOGIN_REDIRECT_URL = "index"
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'corres2math/templates')] 'DIRS': [os.path.join(BASE_DIR, 'corres2math/templates')],
,
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
@ -216,6 +215,6 @@ else:
} }
if os.getenv("CORRES2MATH_STAGE", "dev") == "prod": if os.getenv("CORRES2MATH_STAGE", "dev") == "prod":
from .settings_prod import * from .settings_prod import * # noqa: F401,F403
else: else:
from .settings_dev import * from .settings_dev import * # noqa: F401,F403

View File

@ -14,8 +14,8 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path, include from django.urls import include, path
from django.views.defaults import bad_request, permission_denied, page_not_found, server_error from django.views.defaults import bad_request, page_not_found, permission_denied, server_error
from django.views.generic import TemplateView from django.views.generic import TemplateView
from registration.views import PhotoAuthorizationView from registration.views import PhotoAuthorizationView

View File

@ -12,7 +12,7 @@ deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
coverage coverage
commands = commands =
coverage run --omit='*migrations*,apps/scripts*' --source=apps ./manage.py test apps/ coverage run --omit='apps/scripts*' --source=apps,corres2math ./manage.py test apps/
coverage report -m coverage report -m
[testenv:linters] [testenv:linters]
@ -25,7 +25,7 @@ deps =
pep8-naming pep8-naming
pyflakes pyflakes
commands = commands =
flake8 apps/ flake8 apps/ corres2math/
[flake8] [flake8]
exclude = exclude =