From 58a26e89a8c48fa6cf036665beef7dcc5d5182e2 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Wed, 2 Aug 2023 17:17:59 +0100 Subject: [PATCH] Correct type annotations None type. Fixes 'code unreachable' --- pyproject.toml | 2 +- voicemeeterlib/factory.py | 4 ++-- voicemeeterlib/remote.py | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8382402..92a2fb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "voicemeeter-api" -version = "2.4.0" +version = "2.4.1" description = "A Python wrapper for the Voiceemeter API" authors = ["onyx-and-iris "] license = "MIT" diff --git a/voicemeeterlib/factory.py b/voicemeeterlib/factory.py index 0229079..ddfe54b 100644 --- a/voicemeeterlib/factory.py +++ b/voicemeeterlib/factory.py @@ -2,7 +2,7 @@ import logging from abc import abstractmethod from enum import IntEnum from functools import cached_property -from typing import Iterable, NoReturn +from typing import Iterable from . import misc from .bus import request_bus_obj as bus @@ -51,7 +51,7 @@ class FactoryBuilder: ) self.logger = logger.getChild(self.__class__.__name__) - def _pinfo(self, name: str) -> NoReturn: + def _pinfo(self, name: str) -> None: """prints progress status for each step""" name = name.split("_")[1] self.logger.debug(self._info[int(getattr(self.BuilderProgress, name))]) diff --git a/voicemeeterlib/remote.py b/voicemeeterlib/remote.py index a9379ed..74e4d76 100644 --- a/voicemeeterlib/remote.py +++ b/voicemeeterlib/remote.py @@ -3,7 +3,7 @@ import logging import time from abc import abstractmethod from queue import Queue -from typing import Iterable, NoReturn, Optional, Union +from typing import Iterable, Optional, Union from .cbindings import CBindings from .error import CAPIError, VMError @@ -62,7 +62,7 @@ class Remote(CBindings): self.producer = Producer(self, queue) self.producer.start() - def login(self) -> NoReturn: + def login(self) -> None: """Login to the API, initialize dirty parameters""" self.gui.launched = self.call(self.bind_login, ok=(0, 1)) == 0 if not self.gui.launched: @@ -75,7 +75,7 @@ class Remote(CBindings): ) self.clear_dirty() - def run_voicemeeter(self, kind_id: str) -> NoReturn: + def run_voicemeeter(self, kind_id: str) -> None: if kind_id not in (kind.name.lower() for kind in KindId): raise VMError(f"Unexpected Voicemeeter type: '{kind_id}'") if kind_id == "potato" and bits == 8: @@ -133,7 +133,7 @@ class Remote(CBindings): and self.cache.get("bus_level") == self._bus_buf ) - def clear_dirty(self) -> NoReturn: + def clear_dirty(self) -> None: try: while self.pdirty or self.mdirty: pass @@ -155,7 +155,7 @@ class Remote(CBindings): self.call(self.bind_get_parameter_float, param.encode(), ct.byref(buf)) return buf.value - def set(self, param: str, val: Union[str, float]) -> NoReturn: + def set(self, param: str, val: Union[str, float]) -> None: """Sets a string or float parameter. Caches value""" if isinstance(val, str): if len(val) >= 512: @@ -191,7 +191,7 @@ class Remote(CBindings): ) from e return int(c_state.value) - def set_buttonstatus(self, id_: int, val: int, mode: int) -> NoReturn: + def set_buttonstatus(self, id_: int, val: int, mode: int) -> None: """Sets a macrobutton parameter. Caches value""" c_state = ct.c_float(float(val)) try: @@ -334,13 +334,13 @@ class Remote(CBindings): self.logger.debug("events thread shutdown started") self.running = False - def logout(self) -> NoReturn: + def logout(self) -> None: """Logout of the API""" time.sleep(0.1) self.call(self.bind_logout) self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}") - def __exit__(self, exc_type, exc_value, exc_traceback) -> NoReturn: + def __exit__(self, exc_type, exc_value, exc_traceback) -> None: """teardown procedures""" self.end_thread() self.logout()