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