*: Fix all typing hint related errors

- Try to mark class variables in component classes.

- Leave typing hints generic, such as 'list' and 'dict' where content is usually
not filled, too complex, or context is unimportant.

- backups: Handle failure for tarfile extraction so that methods are not called
on potentially None valued variables.

- backups: Prevent potentially passing a keyword argument twice.

- dynamicdns: Deal properly with outcome of urlparsing.

- ejabberd: Deal with failed regex match

- email: Fix a mypy compliant when iterating a filtered list.

- tor: Don't reuse variables for different typed values.

- tor: Don't reuse variables for different typed values.

- operation: Return None explicitly.

- operation: Ensure that keyword argument is not repeated.

Tests:

- Where only typing hints were modified and no syntax error came up, additional
testing was not done.

- `mypy --ignore-missing-imports .` run successfully.

- Generate developer documentation.

- Service runs without errors upon start up.

- backups: Listing and restoring specific apps from a backup works.

- backups: Mounting a remote backup repository works.

- NOT TESTED: dynamicdns: Migrating from old style configuration works.

- ejabberd: Verify that setting coturn configuration works.

- email: Test that showing configuration from postfix works.

- tor: Orport value is properly shown.

- transmission: Configuration values are properly set.

- users: Running unit tests as root works.

- operation: Operation status messages are show properly during app install.

- ./setup.py install runs

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:24 -04:00
1 parent a709f3a6a8
commit 2dd00a8f08
43 files changed
+111 -87

No files matched your search

+1 -1
View File
@@ -3,4 +3,4 @@
Application manifest for storage.
"""
backup = {}
backup: dict = {}
+5 -5
View File
@@ -14,7 +14,7 @@ gio = import_from_gi('Gio', '2.0')
_DBUS_NAME = 'org.freedesktop.UDisks2'
_INTERFACES = {
_INTERFACES: dict[str, str] = {
'Ata': 'org.freedesktop.UDisks2.Drive.Ata',
'Block': 'org.freedesktop.UDisks2.Block',
'Drive': 'org.freedesktop.UDisks2.Drive',
@@ -28,14 +28,14 @@ _INTERFACES = {
'UDisks2': 'org.freedesktop.UDisks2',
}
_OBJECTS = {
_OBJECTS: dict[str, str] = {
'drives': '/org/freedesktop/UDisks2/drives/',
'jobs': '/org/freedesktop/UDisks2/jobs/',
'Manager': '/org/freedesktop/UDisks2/Manager',
'UDisks2': '/org/freedesktop/UDisks2',
}
_ERRORS = {
_ERRORS: dict[str, str] = {
'AlreadyMounted': 'org.freedesktop.UDisks2.Error.AlreadyMounted',
'Failed': 'org.freedesktop.UDisks2.Error.Failed',
}
@@ -54,8 +54,8 @@ def _get_dbus_proxy(object_, interface):
class Proxy:
"""Base methods for abstraction over UDisks2 DBus proxy objects."""
interface = None
properties = {}
interface: str | None = None
properties: dict[str, tuple[str, str]] = {}
def __init__(self, object_path):
"""Return an object instance."""