From bf7d7124747e59f4611ddce7ed9483fe7b525146 Mon Sep 17 00:00:00 2001 From: Tobias Messner Date: Fri, 29 Nov 2024 12:15:00 +0100 Subject: [PATCH] fix: Fix some mypy issues --- .../settings/configuration/models.py | 61 ++++++++++--------- backend/capellacollab/tools/models.py | 2 +- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/backend/capellacollab/settings/configuration/models.py b/backend/capellacollab/settings/configuration/models.py index 5dbb91d2c..c1cbc1d03 100644 --- a/backend/capellacollab/settings/configuration/models.py +++ b/backend/capellacollab/settings/configuration/models.py @@ -5,6 +5,7 @@ import enum import typing as t import zoneinfo +from collections import abc as collections_abc import pydantic from croniter import croniter @@ -69,40 +70,40 @@ class CustomNavbarLink(NavbarLink): class NavbarConfiguration(core_pydantic.BaseModelStrict): - external_links: list[BuiltInNavbarLink | CustomNavbarLink] = ( - pydantic.Field( - default=( + external_links: collections_abc.Sequence[ + BuiltInNavbarLink | CustomNavbarLink + ] = pydantic.Field( + default=( + [ + BuiltInNavbarLink( + name="Grafana", + service=BuiltInLinkItem.GRAFANA, + role=users_models.Role.ADMIN, + ), + BuiltInNavbarLink( + name="Prometheus", + service=BuiltInLinkItem.PROMETHEUS, + role=users_models.Role.ADMIN, + ), + BuiltInNavbarLink( + name="Documentation", + service=BuiltInLinkItem.DOCUMENTATION, + role=users_models.Role.USER, + ), + ] + + ( [ BuiltInNavbarLink( - name="Grafana", - service=BuiltInLinkItem.GRAFANA, - role=users_models.Role.ADMIN, - ), - BuiltInNavbarLink( - name="Prometheus", - service=BuiltInLinkItem.PROMETHEUS, - role=users_models.Role.ADMIN, - ), - BuiltInNavbarLink( - name="Documentation", - service=BuiltInLinkItem.DOCUMENTATION, + name="SMTP Mock", + service=BuiltInLinkItem.SMTP_MOCK, role=users_models.Role.USER, - ), + ) ] - + ( - [ - BuiltInNavbarLink( - name="SMTP Mock", - service=BuiltInLinkItem.SMTP_MOCK, - role=users_models.Role.USER, - ) - ] - if core.DEVELOPMENT_MODE - else [] - ) - ), - description="Links to display in the navigation bar.", - ) + if core.DEVELOPMENT_MODE + else [] + ) + ), + description="Links to display in the navigation bar.", ) diff --git a/backend/capellacollab/tools/models.py b/backend/capellacollab/tools/models.py index b45a12a57..1d3b889bb 100644 --- a/backend/capellacollab/tools/models.py +++ b/backend/capellacollab/tools/models.py @@ -64,7 +64,7 @@ class ToolSessionEnvironment(core_pydantic.BaseModel): ), ) value: str = pydantic.Field( - default={"RMT_PASSWORD": "{CAPELLACOLLAB_SESSION_TOKEN}"}, + default='"RMT_PASSWORD": "{CAPELLACOLLAB_SESSION_TOKEN}"', description=( "Environment variables, which are mounted into session containers. " "You can use f-strings to reference other environment variables in the value. "