Skip to content
Snippets Groups Projects
Commit 302b7e12 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch 'check/update-pyproject-toml' into 'master'

Update pyproject.toml

See merge request !354
parents fa99a3c0 f16d9ed7
No related branches found
No related tags found
1 merge request!354Update pyproject.toml
Pipeline #194465 failed
......@@ -8,10 +8,7 @@ import MobileFullscreenDialog from "aleksis.core/components/generic/dialogs/Mobi
import updateParticipationMixin from "./updateParticipationMixin.js";
import deepSearchMixin from "aleksis.core/mixins/deepSearchMixin.js";
import LessonInformation from "../documentation/LessonInformation.vue";
import {
extendParticipationStatuses,
updateParticipationStatuses,
} from "./participationStatus.graphql";
import { extendParticipationStatuses } from "./participationStatus.graphql";
import SlideIterator from "aleksis.core/components/generic/SlideIterator.vue";
import PersonalNotes from "../personal_notes/PersonalNotes.vue";
import PersonalNoteChip from "../personal_notes/PersonalNoteChip.vue";
......
......@@ -5,7 +5,7 @@
<absence-reason-chip
v-for="absenceReason in absenceReasons"
:key="absenceReason.id"
:absenceReason="absenceReason.absenceReason"
:absence-reason="absenceReason.absenceReason"
:count="absenceReason.count"
/>
</v-card-text>
......
import { hasPersonValidator } from "aleksis.core/routeValidators";
import { DateTime } from "luxon";
import { MODE } from "./components/coursebook/statistics/modes";
......
from collections.abc import Sequence
from datetime import date, datetime
from typing import TYPE_CHECKING, Optional, Sequence, Union
from typing import TYPE_CHECKING, Optional, Union
from django.db.models import QuerySet
from django.db.models.query import Prefetch
......
from datetime import datetime
from typing import List, Optional
from typing import Optional
from django.contrib.auth.models import User
from django.core.exceptions import PermissionDenied
......@@ -117,7 +117,7 @@ class Documentation(CalendarEvent):
if self.course:
return self.course.groups.all()
def get_teachers_short_names(self) -> List[str]:
def get_teachers_short_names(self) -> list[str]:
return [teacher.short_name or teacher.name for teacher in self.teachers.all()]
def __str__(self) -> str:
......
import datetime
from typing import List
from django.core.exceptions import PermissionDenied
......@@ -28,7 +27,7 @@ class AbsencesForPersonsCreateMutation(graphene.Mutation):
cls,
root,
info,
persons: List[str | int],
persons: list[str | int],
start: datetime.datetime,
end: datetime.datetime,
comment: str,
......
from datetime import date
from typing import List, Optional
from typing import Optional
from django.db.models import Prefetch, Q
from django.utils.translation import gettext as _
......@@ -19,7 +19,7 @@ from .models import Documentation, ExtraMark, NewPersonalNote, ParticipationStat
@recorded_task
def generate_full_register_printout(
groups: List[int],
groups: list[int],
file_object: int,
recorder: ProgressRecorder,
include_cover: Optional[bool] = True,
......@@ -142,9 +142,7 @@ def generate_full_register_printout(
group.as_list = [group]
if include_coursebook:
group.documentations = documentations.order_by(
"datetime_start"
).prefetch_related(
group.documentations = documentations.order_by("datetime_start").prefetch_related(
prefetch_notable_participations(select_related=["person"]),
prefetch_personal_notes("personal_notes", select_related=["person"]),
)
......
......@@ -22,10 +22,7 @@ def is_group_owner(user: User, obj: Union[Group, Person]) -> bool:
Checks whether the person linked to the user is the owner of the given group.
If there isn't provided a group, it will return `False`.
"""
if isinstance(obj, Group) and user.person in obj.owners.all():
return True
return False
return bool(isinstance(obj, Group) and user.person in obj.owners.all())
@predicate
......@@ -88,10 +85,7 @@ def is_group_member(user: User, obj: Union[Group, Person]) -> bool:
Checks whether the person linked to the user is a member of the given group.
If there isn't provided a group, it will return `False`.
"""
if isinstance(obj, Group) and user.person in obj.members.all():
return True
return False
return bool(isinstance(obj, Group) and user.person in obj.members.all())
@predicate
......@@ -252,14 +246,13 @@ def can_view_any_documentation(user: User):
if allowed_lesson_events.exists():
return True
if Documentation.objects.filter(
Q(teachers=user.person)
| Q(amends__in=allowed_lesson_events)
| Q(course__teachers=user.person)
).exists():
return True
return False
return bool(
Documentation.objects.filter(
Q(teachers=user.person)
| Q(amends__in=allowed_lesson_events)
| Q(course__teachers=user.person)
).exists()
)
@predicate
......@@ -316,27 +309,22 @@ def is_in_allowed_time_range(user: User, obj: Union[Documentation, NewPersonalNo
"""
if isinstance(obj, NewPersonalNote):
obj = obj.documentation
if obj and (
get_site_preferences()["alsijil__allow_edit_future_documentations"] == "all"
or (
get_site_preferences()["alsijil__allow_edit_future_documentations"] == "current_day"
return bool(
obj
and (
get_site_preferences()["alsijil__allow_edit_future_documentations"] == "all"
or get_site_preferences()["alsijil__allow_edit_future_documentations"] == "current_day"
and obj.value_start_datetime(obj).date() <= localdate()
)
or (
get_site_preferences()["alsijil__allow_edit_future_documentations"] == "current_time"
or get_site_preferences()["alsijil__allow_edit_future_documentations"] == "current_time"
and obj.value_start_datetime(obj) <= now()
)
):
return True
return False
)
@predicate
def is_in_allowed_time_range_for_participation_status(user: User, obj: Documentation):
"""Predicate which checks if the documentation is in the allowed time range for editing."""
if obj and obj.value_start_datetime(obj) <= now():
return True
return False
return bool(obj and obj.value_start_datetime(obj) <= now())
@predicate
......
from typing import Any, Dict
from typing import Any
from django.core.exceptions import BadRequest, PermissionDenied
from django.db.models import Q
......@@ -146,7 +146,7 @@ class AssignedGroupRolesView(PermissionRequiredMixin, DetailView):
model = Group
template_name = "alsijil/group_role/assigned_list.html"
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
context = super().get_context_data()
today = timezone.now().date()
......@@ -190,7 +190,7 @@ class AssignGroupRoleView(PermissionRequiredMixin, SuccessNextMixin, AdvancedCre
kwargs["initial"] = {"role": self.role, "groups": [self.group]}
return kwargs
def get_context_data(self, **kwargs: Any) -> Dict[str, Any]:
def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
context = super().get_context_data(**kwargs)
context["role"] = self.role
context["group"] = self.group
......
......@@ -24,7 +24,7 @@ authors = [
"mirabilos <thorsten.glaser@teckids.org>",
"Tom Teichler <tom.teichler@teckids.org>"
]
maintainers = ["Jonathan Weth <dev@jonathanweth.de>", "Dominik George <dominik.george@teckids.org>"]
maintainers = ["Jonathan Weth <jonathan.weth@teckids.org>", "Dominik George <dominik.george@teckids.org>"]
license = "EUPL-1.2-or-later"
homepage = "https://aleksis.org"
repository = "https://edugit.org/AlekSIS/official/AlekSIS-App-Alsijil"
......@@ -46,7 +46,6 @@ priority = "primary"
name = "gitlab"
url = "https://edugit.org/api/v4/projects/461/packages/pypi/simple"
priority = "supplemental"
[tool.poetry.dependencies]
python = "^3.10"
aleksis-core = "^4.0.0.dev11"
......@@ -64,18 +63,16 @@ alsijil = "aleksis.apps.alsijil.apps:AlsijilConfig"
django-stubs = "^4.2"
safety = "^2.3.5"
ruff = "^0.1.5"
curlylint = "^0.13.0"
ruff = "^0.8.2"
[tool.poetry.group.test.dependencies]
pytest = "^7.2"
pytest-django = "^4.1"
pytest = "^8.3"
pytest-django = "^4.9"
pytest-django-testing-postgresql = "^0.2"
pytest-cov = "^4.0.0"
pytest-sugar = "^0.9.2"
selenium = "<4.10.0"
freezegun = "^1.1.0"
pytest-cov = "^6.0.0"
pytest-sugar = "^1.0.0"
selenium = "^4.27.0"
freezegun = "^1.5.0"
[tool.poetry.group.docs]
optional = true
......@@ -86,20 +83,20 @@ sphinxcontrib-django = "^2.3.0"
sphinxcontrib-svg2pdfconverter = "^1.1.1"
sphinx-autodoc-typehints = "^1.7"
sphinx_material = "^0.0.35"
[tool.ruff]
exclude = ["migrations", "tests"]
exclude = ["migrations"]
line-length = 100
[tool.ruff.lint]
select = ["E", "F", "UP", "B", "SIM", "I", "DJ", "A", "S"]
ignore = ["UP034", "UP015", "B028"]
[tool.ruff.isort]
[tool.ruff.lint.extend-per-file-ignores]
"**/*/tests/**/*.py" = ["S101", "ARG", "FBT", "PLR2004", "S311", "S105"]
[tool.ruff.lint.isort]
known-first-party = ["aleksis"]
section-order = ["future", "standard-library", "django", "third-party", "first-party", "local-folder"]
[tool.ruff.isort.sections]
[tool.ruff.lint.isort.sections]
django = ["django"]
[build-system]
requires = ["poetry-core>=1.0.0"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment