*: 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:
Sunil Mohan Adapa authored and James Valleroy committed 2023-09-25 20:03:34 -04:00
1 parent a86a86d605
commit 38ece87c6c
29 files changed
+116 -140

No files matched your search

+1 -2
View File
@@ -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'],
+3 -3
View File
@@ -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)