mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
typing: fix logger typing + ignore weird constructors
This commit is contained in:
parent
a924379774
commit
6bcc3dd1c0
2 changed files with 13 additions and 5 deletions
|
@ -31,10 +31,12 @@ from yunohost.log import is_unit_operation
|
|||
from yunohost.utils.legacy import translate_legacy_settings_to_configpanel_settings
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from yunohost.log import OperationLogger
|
||||
from typing import cast
|
||||
|
||||
from pydantic.typing import AbstractSetIntStr, MappingIntStrAny
|
||||
|
||||
from moulinette.utils.log import MoulinetteLogger
|
||||
from yunohost.log import OperationLogger
|
||||
from yunohost.utils.configpanel import (
|
||||
ConfigPanelGetMode,
|
||||
ConfigPanelModel,
|
||||
|
@ -43,7 +45,9 @@ if TYPE_CHECKING:
|
|||
)
|
||||
from yunohost.utils.form import FormModel
|
||||
|
||||
logger = getLogger("yunohost.settings")
|
||||
logger = cast(MoulinetteLogger, getLogger("yunohost.settings"))
|
||||
else:
|
||||
logger = getLogger("yunohost.settings")
|
||||
|
||||
SETTINGS_PATH = "/etc/yunohost/settings.yml"
|
||||
|
||||
|
|
|
@ -51,7 +51,11 @@ if TYPE_CHECKING:
|
|||
from yunohost.utils.form import FormModel, Hooks
|
||||
from yunohost.log import OperationLogger
|
||||
|
||||
logger = getLogger("yunohost.configpanel")
|
||||
if TYPE_CHECKING:
|
||||
from moulinette.utils.log import MoulinetteLogger
|
||||
logger = cast(MoulinetteLogger, getLogger("yunohost.configpanel"))
|
||||
else:
|
||||
logger = getLogger("yunohost.configpanel")
|
||||
|
||||
|
||||
# ╭───────────────────────────────────────────────────────╮
|
||||
|
@ -145,7 +149,7 @@ class SectionModel(ContainerModel, OptionsModel):
|
|||
is_action_section = any(
|
||||
[option["type"] == OptionType.button for option in options]
|
||||
)
|
||||
ContainerModel.__init__(
|
||||
ContainerModel.__init__( # type: ignore
|
||||
self,
|
||||
id=id,
|
||||
name=name,
|
||||
|
@ -221,7 +225,7 @@ class PanelModel(ContainerModel):
|
|||
**kwargs,
|
||||
) -> None:
|
||||
sections = [data | {"id": name} for name, data in kwargs.items()]
|
||||
super().__init__(
|
||||
super().__init__( # type: ignore
|
||||
id=id, name=name, services=services, help=help, bind=bind, sections=sections
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue