mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
*: Add type hints for app init methods
- This is so that the methods will be checked by mypy. This should help identify any incorrect initialization of components. - Remove unused self.repos in GitwebApp. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
3a7dd4e812
commit
f9b186e14f
@ -58,7 +58,7 @@ class App:
|
||||
NEEDS_UPDATE = 'needs-update'
|
||||
UP_TO_DATE = 'up-to-date'
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Build the app by adding components.
|
||||
|
||||
App may be built just for the purpose for querying. For example, when
|
||||
@ -71,7 +71,7 @@ class App:
|
||||
if not self.app_id:
|
||||
raise ValueError('Invalid app ID configured')
|
||||
|
||||
self.components = collections.OrderedDict()
|
||||
self.components: dict[str, Component] = collections.OrderedDict()
|
||||
|
||||
# Add self to global list of apps
|
||||
self._all_apps[self.app_id] = self
|
||||
|
||||
@ -24,7 +24,7 @@ class ApacheApp(app_module.App):
|
||||
|
||||
_version = 12
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
@ -61,8 +61,8 @@ class ApacheApp(app_module.App):
|
||||
daemon = Daemon('daemon-apache', 'apache2')
|
||||
self.add(daemon)
|
||||
|
||||
daemon = RelatedDaemon('related-daemon-apache', 'uwsgi')
|
||||
self.add(daemon)
|
||||
related_daemon = RelatedDaemon('related-daemon-apache', 'uwsgi')
|
||||
self.add(related_daemon)
|
||||
|
||||
def setup(self, old_version):
|
||||
"""Install and configure the app."""
|
||||
|
||||
@ -13,7 +13,7 @@ class ApiApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ class AvahiApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class BackupsApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ class BepastyApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ class BindApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ class CalibreApp(app_module.App):
|
||||
|
||||
DAEMON = 'calibre-server-freedombox'
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class CockpitApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class ConfigApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
info = app_module.Info(app_id=self.app_id, version=self._version,
|
||||
|
||||
@ -44,7 +44,7 @@ class CoturnApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ class DateTimeApp(app_module.App):
|
||||
|
||||
return self._time_managed
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
@ -77,9 +77,9 @@ class DateTimeApp(app_module.App):
|
||||
packages = Packages('packages-datetime', ['systemd-timesyncd'])
|
||||
self.add(packages)
|
||||
|
||||
daemon = RelatedDaemon('daemon-datetime-timedated',
|
||||
'systemd-timedated')
|
||||
self.add(daemon)
|
||||
related_daemon = RelatedDaemon('daemon-datetime-timedated',
|
||||
'systemd-timedated')
|
||||
self.add(related_daemon)
|
||||
|
||||
if self._is_time_managed():
|
||||
daemon = Daemon('daemon-datetime', 'systemd-timesyncd')
|
||||
|
||||
@ -33,7 +33,7 @@ class DelugeApp(app_module.App):
|
||||
|
||||
_version = 8
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class DiagnosticsApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
info = app_module.Info(app_id=self.app_id, version=self._version,
|
||||
|
||||
@ -52,7 +52,7 @@ class DynamicDNSApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ class EjabberdApp(app_module.App):
|
||||
|
||||
_version = 8
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ class EmailApp(plinth.app.App):
|
||||
|
||||
_version = 4
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the email app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ class FirewallApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ class FirstBootApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -38,14 +38,12 @@ class GitwebApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
groups = {'git-access': _('Read-write access to Git repositories')}
|
||||
|
||||
self.repos = []
|
||||
|
||||
info = app_module.Info(app_id=self.app_id, version=self._version,
|
||||
name=_('Gitweb'), icon_filename='gitweb',
|
||||
short_description=_('Simple Git Hosting'),
|
||||
|
||||
@ -22,7 +22,7 @@ class HelpApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class I2PApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ class IkiwikiApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ class InfinotedApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class JanusApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ class JSXCApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ class KiwixApp(app_module.App):
|
||||
|
||||
DAEMON = 'kiwix-server-freedombox'
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ class LetsEncryptApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ class MatrixSynapseApp(app_module.App):
|
||||
|
||||
_version = 10
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class MediaWikiApp(app_module.App):
|
||||
|
||||
_version = 12
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
self._private_mode = True
|
||||
|
||||
@ -48,7 +48,7 @@ class MinetestApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ class MiniDLNAApp(app_module.App):
|
||||
|
||||
_version = 5
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Initialize the app components."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ class MumbleApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class NamesApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
info = app_module.Info(app_id=self.app_id, version=self._version,
|
||||
|
||||
@ -50,7 +50,7 @@ class NetworksApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -36,7 +36,7 @@ class OpenVPNApp(app_module.App):
|
||||
|
||||
_version = 5
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ class PagekiteApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ class PerformanceApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ class PowerApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ class PrivacyApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class PrivoxyApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ class QuasselApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ class RadicaleApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class RoundcubeApp(app_module.App):
|
||||
|
||||
_version = 4
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ class RSSBridgeApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ class SambaApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ class SearxApp(app_module.App):
|
||||
|
||||
_version = 6
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ class SecurityApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ class ShaarliApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ class ShadowsocksApp(app_module.App):
|
||||
|
||||
DAEMON = 'shadowsocks-libev-local@freedombox'
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ class ShadowsocksServerApp(app_module.App):
|
||||
|
||||
DAEMON = 'shadowsocks-libev-server@fbxserver'
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ class SharingApp(app_module.App):
|
||||
|
||||
_version = 3
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
info = app_module.Info(app_id=self.app_id, version=self._version,
|
||||
|
||||
@ -42,7 +42,7 @@ class SnapshotApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ class SSHApp(app_module.App):
|
||||
|
||||
_version = 4
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ class SSOApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ class StorageApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class SyncthingApp(app_module.App):
|
||||
|
||||
DAEMON = 'syncthing@syncthing'
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ class TorApp(app_module.App):
|
||||
|
||||
_version = 7
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -47,7 +47,7 @@ class TorProxyApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@ class TransmissionApp(app_module.App):
|
||||
|
||||
DAEMON = 'transmission-daemon'
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ class TTRSSApp(app_module.App):
|
||||
|
||||
_version = 6
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ class UpgradesApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ class UsersApp(app_module.App):
|
||||
|
||||
can_be_disabled = False
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ class WireguardApp(app_module.App):
|
||||
|
||||
_version = 1
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ class WordPressApp(app_module.App):
|
||||
|
||||
_version = 4
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ class ZophApp(app_module.App):
|
||||
|
||||
_version = 2
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
"""Create components for the app."""
|
||||
super().__init__()
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user