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
@@ -5,7 +5,7 @@ import logging
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from typing import Any, Optional, Union
|
||||
from typing import Any
|
||||
|
||||
import augeas
|
||||
|
||||
@@ -66,9 +66,9 @@ def _first_time_setup():
|
||||
|
||||
|
||||
@privileged
|
||||
def configure(use_upstream_bridges: Optional[bool] = None,
|
||||
upstream_bridges: Optional[str] = None,
|
||||
apt_transport_tor: Optional[bool] = None):
|
||||
def configure(use_upstream_bridges: bool | None = None,
|
||||
upstream_bridges: str | None = None,
|
||||
apt_transport_tor: bool | None = None):
|
||||
"""Configure Tor."""
|
||||
aug = augeas_load()
|
||||
|
||||
@@ -92,7 +92,7 @@ def restart():
|
||||
|
||||
|
||||
@privileged
|
||||
def get_status() -> dict[str, Union[bool, str, dict[str, Any]]]:
|
||||
def get_status() -> dict[str, bool | str | dict[str, Any]]:
|
||||
"""Return dict with Tor Proxy status."""
|
||||
aug = augeas_load()
|
||||
return {
|
||||
@@ -125,8 +125,7 @@ def _disable():
|
||||
action_utils.service_disable(SERVICE_NAME)
|
||||
|
||||
|
||||
def _use_upstream_bridges(use_upstream_bridges: Optional[bool] = None,
|
||||
aug=None):
|
||||
def _use_upstream_bridges(use_upstream_bridges: bool | None = None, aug=None):
|
||||
"""Enable use of upstream bridges."""
|
||||
if use_upstream_bridges is None:
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user