mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
*: Utilize newer 3.10 syntax for type hints
Tests: - mypy does not show any errors. - Installing ejabberd app works. Privileged actions run fine. - Unit tests work. - No additional testing was done as type annotations don't have any effect at runtime. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
a86a86d605
commit
38ece87c6c
29 files changed
+116
-140
No files matched your search
@@ -3,7 +3,6 @@
|
||||
|
||||
import json
|
||||
import logging
|
||||
from typing import Tuple
|
||||
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
@@ -226,7 +225,7 @@ def update_turn_configuration(config: TurnConfiguration, managed=True,
|
||||
privileged.configure_turn(json.loads(config.to_json()), managed)
|
||||
|
||||
|
||||
def get_turn_configuration() -> Tuple[TurnConfiguration, bool]:
|
||||
def get_turn_configuration() -> tuple[TurnConfiguration, bool]:
|
||||
"""Get the latest STUN/TURN configuration."""
|
||||
tc, managed = privileged.get_turn_config()
|
||||
return TurnConfiguration(tc['domain'], tc['uris'],
|
||||
|
||||
@@ -8,7 +8,7 @@ import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional, Tuple
|
||||
from typing import Any
|
||||
|
||||
from ruamel.yaml import YAML, scalarstring
|
||||
|
||||
@@ -240,7 +240,7 @@ def set_domains(domains: list[str]):
|
||||
|
||||
|
||||
@privileged
|
||||
def mam(command: str) -> Optional[bool]:
|
||||
def mam(command: str) -> bool | None:
|
||||
"""Enable, disable, or get status of Message Archive Management (MAM)."""
|
||||
if command not in ('enable', 'disable', 'status'):
|
||||
raise ValueError('Invalid command')
|
||||
@@ -308,7 +308,7 @@ def _generate_uris(services: list[dict]) -> list[str]:
|
||||
|
||||
|
||||
@privileged
|
||||
def get_turn_config() -> Tuple[dict[str, Any], bool]:
|
||||
def get_turn_config() -> tuple[dict[str, Any], bool]:
|
||||
"""Get the latest STUN/TURN configuration in JSON format."""
|
||||
with open(EJABBERD_CONFIG, 'r', encoding='utf-8') as file_handle:
|
||||
conf = yaml.load(file_handle)
|
||||
|
||||
Reference in new issue
Block a user