Skip to content

Commit

Permalink
refactor(core): migrate ubo_app/services.py to `typings/ubo_handle.…
Browse files Browse the repository at this point in the history
…pyi` as it was only providing types
  • Loading branch information
sassanh committed Aug 2, 2024
1 parent e9541be commit 89451e5
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 49 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- fix(audio): add a recovery mechanism for audio service to rebind the sound card if it is not available - closes #83
- fix(voice): remove the gap between sentences
- fix(core): change the power-off menu item icon - closes #151
- refactor(core): migrate `ubo_app/services.py` to `typings/ubo_handle.pyi` as it was only providing types

## Version 0.15.5

Expand Down
18 changes: 18 additions & 0 deletions typings/ubo_handle.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from collections.abc import Callable, Coroutine
from typing import Protocol, TypeAlias

from redux import ReducerType

class Service(Protocol):
def register_reducer(self: Service, reducer: ReducerType) -> None: ...

SetupFunction: TypeAlias = (
Callable[[Service], Coroutine | None] | Callable[[], Coroutine | None]
)

def register(
*,
service_id: str,
label: str,
setup: SetupFunction,
) -> None: ...
2 changes: 1 addition & 1 deletion ubo_app/load_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from importlib.machinery import ModuleSpec
from types import ModuleType

from ubo_app.services import SetupFunction
from ubo_handle import SetupFunction # pyright: ignore [reportMissingModuleSource]

ROOT_PATH = Path(__file__).parent
REGISTERED_PATHS: dict[Path, UboServiceThread] = {}
Expand Down
33 changes: 0 additions & 33 deletions ubo_app/services.py

This file was deleted.

2 changes: 1 addition & 1 deletion ubo_app/services/000-audio/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/000-keypad/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import register
from ubo_handle import register


def setup() -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/010-notifications/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/010-voice/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/020-keyboard/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import register
from ubo_handle import register


def setup() -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/030-ethernet/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import register
from ubo_handle import register


def setup() -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/030-ip/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


async def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/030-wifi/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


async def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/040-camera/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/040-rgb-ring/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/040-sensors/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/050-lightdm/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/050-ssh/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/050-vscode/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


async def setup(service: Service) -> None:
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/services/080-docker/ubo_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ubo_app.services import Service, register
from ubo_handle import Service, register


def setup(service: Service) -> None:
Expand Down

0 comments on commit 89451e5

Please sign in to comment.