Fixing black

This commit is contained in:
Finn Stutzenstein 2020-08-31 13:24:16 +02:00
parent 9a4f8e1781
commit 325c5ea1f4
No known key found for this signature in database
GPG Key ID: 9042F605C6324654
19 changed files with 35 additions and 36 deletions

1
.gitignore vendored
View File

@ -20,6 +20,7 @@ Thumbs.db
# Virtual Environment
.virtualenv*/*
.venv/*
server/.venv
## Compatibility
# OS4-Submodules

View File

@ -109,7 +109,7 @@ jobs:
script:
- flake8 openslides tests
- isort --check-only --diff --recursive openslides tests
- black --check --diff --target-version py36 openslides tests
- black --check --diff openslides tests
- mypy openslides/ tests/
- pytest --cov --cov-fail-under=75
@ -122,7 +122,7 @@ jobs:
script:
- flake8 openslides tests
- isort --check-only --diff --recursive openslides tests
- black --check --diff --target-version py36 openslides tests
- black --check --diff openslides tests
- mypy openslides/ tests/
- pytest --cov --cov-fail-under=75

View File

@ -360,8 +360,6 @@ class ListOfSpeakersManager(BaseManager):
class ListOfSpeakers(RESTModelMixin, models.Model):
"""
"""
access_permissions = ListOfSpeakersAccessPermissions()
objects = ListOfSpeakersManager()

View File

@ -20,5 +20,5 @@ class Migration(migrations.Migration):
migrations.RemoveField(model_name="assignmentpoll", name="votesabstain"),
migrations.RemoveField(model_name="assignmentpoll", name="votesno"),
migrations.RemoveField(model_name="assignmentpoll", name="published"),
migrations.RemoveField(model_name="assignmentrelateduser", name="elected",),
migrations.RemoveField(model_name="assignmentrelateduser", name="elected"),
]

View File

@ -13,6 +13,6 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterUniqueTogether(
name="assignmentvote", unique_together={("user", "option")},
name="assignmentvote", unique_together={("user", "option")}
),
]

View File

@ -465,14 +465,14 @@ class AssignmentPollViewSet(BasePollViewSet):
)
if (
poll.pollmethod == AssignmentPoll.POLLMETHOD_YNA
and value not in ("Y", "N", "A",)
and value not in ("Y", "N", "A")
):
raise ValidationError(
{"detail": "Every value must be Y, N or A"}
)
elif (
poll.pollmethod == AssignmentPoll.POLLMETHOD_YN
and value not in ("Y", "N",)
and value not in ("Y", "N")
):
raise ValidationError({"detail": "Every value must be Y or N"})
@ -526,7 +526,7 @@ class AssignmentPollViewSet(BasePollViewSet):
for option_id, result in data.items():
option = options.get(pk=option_id)
vote = AssignmentVote.objects.create(
option=option, user=vote_user, value=result, weight=weight,
option=option, user=vote_user, value=result, weight=weight
)
inform_changed_data(vote, no_delete_on_restriction=True)
inform_changed_data(option, no_delete_on_restriction=True)

View File

@ -9,6 +9,4 @@ class Migration(migrations.Migration):
("core", "0027_projector_size_2"),
]
operations = [
migrations.RemoveField(model_name="projector", name="height",),
]
operations = [migrations.RemoveField(model_name="projector", name="height")]

View File

@ -14,7 +14,7 @@ def add_poll_projection_defaults(apps, schema_editor):
projectiondefaults.append(
ProjectionDefault(
name="assignment_poll", display_name="Ballots", projector=default_projector,
name="assignment_poll", display_name="Ballots", projector=default_projector
)
)
projectiondefaults.append(

View File

@ -53,11 +53,15 @@ class MotionAccessPermissions(BaseAccessPermissions):
# Parse values of restriction field.
# If at least one restriction is ok, permissions are granted.
for value in restriction:
if value in (
"motions.can_see_internal",
"motions.can_manage_metadata",
"motions.can_manage",
) and await async_has_perm(user_id, value):
if (
value
in (
"motions.can_see_internal",
"motions.can_manage_metadata",
"motions.can_manage",
)
and await async_has_perm(user_id, value)
):
permission = True
break
elif value == "is_submitter" and is_submitter:

View File

@ -13,6 +13,6 @@ class Migration(migrations.Migration):
operations = [
migrations.AlterUniqueTogether(
name="motionvote", unique_together={("user", "option")},
),
name="motionvote", unique_together={("user", "option")}
)
]

View File

@ -193,7 +193,7 @@ class Motion(RESTModelMixin, AgendaItemWithListOfSpeakersMixin, models.Model):
"""
motion_block = models.ForeignKey(
"MotionBlock", on_delete=SET_NULL_AND_AUTOUPDATE, null=True, blank=True,
"MotionBlock", on_delete=SET_NULL_AND_AUTOUPDATE, null=True, blank=True
)
"""
ForeignKey to one block of motions.

View File

@ -1744,8 +1744,6 @@ class StateViewSet(ModelViewSet, ProtectedErrorMessageMixin):
return result
def create(self, request, *args, **kwargs):
"""
"""
result = super().create(request, *args, **kwargs)
workflow_id = request.data[
"workflow_id"

View File

@ -165,7 +165,7 @@ class ElementCache:
logger.info("Done saving the cache data.")
def _build_cache_get_elementid_model_mapping(
self, config_only: bool = False,
self, config_only: bool = False
) -> Dict[str, str]:
"""
Do NOT call this in an asynchronous context!

View File

@ -98,5 +98,5 @@ class ConsumerAutoupdateStrategy:
self.client_change_id = max_change_id
# It will be send, so we can set the client_change_id
await self.consumer.send_json(
type="autoupdate", content=autoupdate, in_response=in_response,
type="autoupdate", content=autoupdate, in_response=in_response
)

View File

@ -143,7 +143,7 @@ class ProtocollAsyncJsonWebsocketConsumer(AsyncCompressedJsonWebsocketConsumer):
)
async def send_exception(
self, e: BaseWebsocketException, silence_errors: Optional[bool] = True,
self, e: BaseWebsocketException, silence_errors: Optional[bool] = True
) -> None:
"""
Send generic error messages with a custom status code (see above) and a text message.

View File

@ -62,7 +62,7 @@ class Notify(BaseWebsocketClientMessage):
perm = self.notify_permissions.get(content["name"])
if perm is not None and not await async_has_perm(consumer.user_id, perm):
raise NotAuthorizedException(
f"You need '{perm}' to send this message.", in_response=id,
f"You need '{perm}' to send this message.", in_response=id
)
else:
# Some logging

View File

@ -105,7 +105,7 @@ def create_assignment_polls():
class CreateAssignmentPoll(TestCase):
def advancedSetUp(self):
self.assignment = Assignment.objects.create(
title="test_assignment_ohneivoh9caiB8Yiungo", open_posts=1,
title="test_assignment_ohneivoh9caiB8Yiungo", open_posts=1
)
self.assignment.add_candidate(self.admin)
@ -576,7 +576,7 @@ class UpdateAssignmentPoll(TestCase):
def test_patch_groups_to_empty(self):
response = self.client.patch(
reverse("assignmentpoll-detail", args=[self.poll.pk]), {"groups_id": []},
reverse("assignmentpoll-detail", args=[self.poll.pk]), {"groups_id": []}
)
self.assertHttpStatusVerbose(response, status.HTTP_200_OK)
poll = AssignmentPoll.objects.get()
@ -869,7 +869,7 @@ class VoteAssignmentPollAnalogYNA(VoteAssignmentPollBaseTestClass):
def test_wrong_data_format(self):
self.start_poll()
response = self.client.post(
reverse("assignmentpoll-vote", args=[self.poll.pk]), [1, 2, 5],
reverse("assignmentpoll-vote", args=[self.poll.pk]), [1, 2, 5]
)
self.assertHttpStatusVerbose(response, status.HTTP_400_BAD_REQUEST)
self.assertFalse(AssignmentVote.objects.exists())
@ -1063,7 +1063,7 @@ class VoteAssignmentPollNamedYNA(VoteAssignmentPollBaseTestClass):
option2 = self.poll2.options.get()
# Do request to poll with option2 (which is wrong...)
response = self.client.post(
reverse("assignmentpoll-vote", args=[self.poll.pk]), {str(option2.id): "Y"},
reverse("assignmentpoll-vote", args=[self.poll.pk]), {str(option2.id): "Y"}
)
self.assertHttpStatusVerbose(response, status.HTTP_400_BAD_REQUEST)
self.assertEqual(AssignmentVote.objects.count(), 0)

View File

@ -488,7 +488,7 @@ class UpdateMotionPoll(TestCase):
def test_patch_groups_to_empty(self):
response = self.client.patch(
reverse("motionpoll-detail", args=[self.poll.pk]), {"groups_id": []},
reverse("motionpoll-detail", args=[self.poll.pk]), {"groups_id": []}
)
self.assertHttpStatusVerbose(response, status.HTTP_200_OK)
poll = MotionPoll.objects.get()
@ -641,7 +641,7 @@ class VoteMotionPollAnalog(TestCase):
def test_vote_missing_data(self):
self.start_poll()
response = self.client.post(
reverse("motionpoll-vote", args=[self.poll.pk]), {"Y": "4", "N": "22.6"},
reverse("motionpoll-vote", args=[self.poll.pk]), {"Y": "4", "N": "22.6"}
)
self.assertHttpStatusVerbose(response, status.HTTP_400_BAD_REQUEST)
self.assertFalse(MotionPoll.objects.get().get_votes().exists())
@ -879,7 +879,7 @@ class VoteMotionPollNamed(TestCase):
class VoteMotionPollNamedAutoupdates(TestCase):
""" 3 important users:
"""3 important users:
self.admin: manager, has can_see, can_manage, can_manage_polls (in admin group)
self.user1: votes, has can_see perms and in in delegate group
self.other_user: Just has can_see perms and is NOT in the delegate group.
@ -1018,7 +1018,7 @@ class VoteMotionPollNamedAutoupdates(TestCase):
class VoteMotionPollPseudoanonymousAutoupdates(TestCase):
""" 3 important users:
"""3 important users:
self.admin: manager, has can_see, can_manage, can_manage_polls (in admin group)
self.user: votes, has can_see perms and in in delegate group
self.other_user: Just has can_see perms and is NOT in the delegate group.

View File

@ -723,7 +723,7 @@ class GroupCreate(TestCase):
self.client.login(username="admin", password="admin")
response = self.client.post(
reverse("group-list"), {"name": "Test name ldr59xq2mvt96rdayhju"},
reverse("group-list"), {"name": "Test name ldr59xq2mvt96rdayhju"}
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)