mirror of
https://github.com/onyx-and-iris/voicemeeter-api-python.git
synced 2024-11-22 11:00:47 +00:00
Correct type annotations None type.
Fixes 'code unreachable'
This commit is contained in:
parent
e96151cd5a
commit
58a26e89a8
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "voicemeeter-api"
|
name = "voicemeeter-api"
|
||||||
version = "2.4.0"
|
version = "2.4.1"
|
||||||
description = "A Python wrapper for the Voiceemeter API"
|
description = "A Python wrapper for the Voiceemeter API"
|
||||||
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
authors = ["onyx-and-iris <code@onyxandiris.online>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
@ -2,7 +2,7 @@ import logging
|
|||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from functools import cached_property
|
from functools import cached_property
|
||||||
from typing import Iterable, NoReturn
|
from typing import Iterable
|
||||||
|
|
||||||
from . import misc
|
from . import misc
|
||||||
from .bus import request_bus_obj as bus
|
from .bus import request_bus_obj as bus
|
||||||
@ -51,7 +51,7 @@ class FactoryBuilder:
|
|||||||
)
|
)
|
||||||
self.logger = logger.getChild(self.__class__.__name__)
|
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"""
|
"""prints progress status for each step"""
|
||||||
name = name.split("_")[1]
|
name = name.split("_")[1]
|
||||||
self.logger.debug(self._info[int(getattr(self.BuilderProgress, name))])
|
self.logger.debug(self._info[int(getattr(self.BuilderProgress, name))])
|
||||||
|
@ -3,7 +3,7 @@ import logging
|
|||||||
import time
|
import time
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from typing import Iterable, NoReturn, Optional, Union
|
from typing import Iterable, Optional, Union
|
||||||
|
|
||||||
from .cbindings import CBindings
|
from .cbindings import CBindings
|
||||||
from .error import CAPIError, VMError
|
from .error import CAPIError, VMError
|
||||||
@ -62,7 +62,7 @@ class Remote(CBindings):
|
|||||||
self.producer = Producer(self, queue)
|
self.producer = Producer(self, queue)
|
||||||
self.producer.start()
|
self.producer.start()
|
||||||
|
|
||||||
def login(self) -> NoReturn:
|
def login(self) -> None:
|
||||||
"""Login to the API, initialize dirty parameters"""
|
"""Login to the API, initialize dirty parameters"""
|
||||||
self.gui.launched = self.call(self.bind_login, ok=(0, 1)) == 0
|
self.gui.launched = self.call(self.bind_login, ok=(0, 1)) == 0
|
||||||
if not self.gui.launched:
|
if not self.gui.launched:
|
||||||
@ -75,7 +75,7 @@ class Remote(CBindings):
|
|||||||
)
|
)
|
||||||
self.clear_dirty()
|
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):
|
if kind_id not in (kind.name.lower() for kind in KindId):
|
||||||
raise VMError(f"Unexpected Voicemeeter type: '{kind_id}'")
|
raise VMError(f"Unexpected Voicemeeter type: '{kind_id}'")
|
||||||
if kind_id == "potato" and bits == 8:
|
if kind_id == "potato" and bits == 8:
|
||||||
@ -133,7 +133,7 @@ class Remote(CBindings):
|
|||||||
and self.cache.get("bus_level") == self._bus_buf
|
and self.cache.get("bus_level") == self._bus_buf
|
||||||
)
|
)
|
||||||
|
|
||||||
def clear_dirty(self) -> NoReturn:
|
def clear_dirty(self) -> None:
|
||||||
try:
|
try:
|
||||||
while self.pdirty or self.mdirty:
|
while self.pdirty or self.mdirty:
|
||||||
pass
|
pass
|
||||||
@ -155,7 +155,7 @@ class Remote(CBindings):
|
|||||||
self.call(self.bind_get_parameter_float, param.encode(), ct.byref(buf))
|
self.call(self.bind_get_parameter_float, param.encode(), ct.byref(buf))
|
||||||
return buf.value
|
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"""
|
"""Sets a string or float parameter. Caches value"""
|
||||||
if isinstance(val, str):
|
if isinstance(val, str):
|
||||||
if len(val) >= 512:
|
if len(val) >= 512:
|
||||||
@ -191,7 +191,7 @@ class Remote(CBindings):
|
|||||||
) from e
|
) from e
|
||||||
return int(c_state.value)
|
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"""
|
"""Sets a macrobutton parameter. Caches value"""
|
||||||
c_state = ct.c_float(float(val))
|
c_state = ct.c_float(float(val))
|
||||||
try:
|
try:
|
||||||
@ -334,13 +334,13 @@ class Remote(CBindings):
|
|||||||
self.logger.debug("events thread shutdown started")
|
self.logger.debug("events thread shutdown started")
|
||||||
self.running = False
|
self.running = False
|
||||||
|
|
||||||
def logout(self) -> NoReturn:
|
def logout(self) -> None:
|
||||||
"""Logout of the API"""
|
"""Logout of the API"""
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
self.call(self.bind_logout)
|
self.call(self.bind_logout)
|
||||||
self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}")
|
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"""
|
"""teardown procedures"""
|
||||||
self.end_thread()
|
self.end_thread()
|
||||||
self.logout()
|
self.logout()
|
||||||
|
Loading…
Reference in New Issue
Block a user