forked from platypush/platypush
Removed typing-extensions
dependency.
The package isn't present on older versions of Debian.
This commit is contained in:
parent
10bf617261
commit
3e8d6bb01e
65 changed files with 2 additions and 243 deletions
|
@ -3,7 +3,6 @@ from http.client import responses
|
|||
import json
|
||||
from logging import getLogger
|
||||
from typing import Optional
|
||||
from typing_extensions import override
|
||||
|
||||
from tornado.web import RequestHandler, stream_request_body
|
||||
|
||||
|
@ -22,7 +21,6 @@ class StreamingRoute(RequestHandler, PubSubMixin, ABC):
|
|||
super().__init__(*args, **kwargs)
|
||||
self.logger = getLogger(__name__)
|
||||
|
||||
@override
|
||||
def prepare(self):
|
||||
"""
|
||||
Request preparation logic. It performs user authentication if
|
||||
|
@ -38,7 +36,6 @@ class StreamingRoute(RequestHandler, PubSubMixin, ABC):
|
|||
'Client %s connected to %s', self.request.remote_ip, self.request.path
|
||||
)
|
||||
|
||||
@override
|
||||
def write_error(self, status_code: int, error: Optional[str] = None, **_):
|
||||
"""
|
||||
Make sure that errors are always returned in JSON format.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from enum import Enum
|
||||
import json
|
||||
from typing import Optional
|
||||
from typing_extensions import override
|
||||
|
||||
from tornado.web import stream_request_body
|
||||
from platypush.context import get_plugin
|
||||
|
@ -37,7 +36,6 @@ class CameraRoute(StreamingRoute):
|
|||
self._request_type = RequestType.UNKNOWN
|
||||
self._extension: str = ''
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def path(cls) -> str:
|
||||
return r"/camera/([a-zA-Z0-9_./]+)/([a-zA-Z0-9_]+)\.?([a-zA-Z0-9_]+)?"
|
||||
|
@ -95,7 +93,6 @@ class CameraRoute(StreamingRoute):
|
|||
|
||||
return kwargs
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def _get_redis_queue(cls, camera: CameraPlugin, *_, **__) -> str:
|
||||
plugin_name = get_plugin_name_by_class(camera.__class__)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from contextlib import contextmanager
|
||||
import json
|
||||
from typing import Generator, Optional
|
||||
from typing_extensions import override
|
||||
|
||||
from tornado.web import stream_request_body
|
||||
|
||||
|
@ -24,7 +23,6 @@ class SoundRoute(StreamingRoute):
|
|||
self._audio_headers_written: bool = False
|
||||
"""Send the audio file headers before we send the first audio frame."""
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def path(cls) -> str:
|
||||
return r"/sound/stream\.?([a-zA-Z0-9_]+)?"
|
||||
|
@ -44,7 +42,6 @@ class SoundRoute(StreamingRoute):
|
|||
yield
|
||||
send_request('sound.stop_recording')
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def _get_redis_queue(cls, *_, device: Optional[str] = None, **__) -> str:
|
||||
return '/'.join([cls._redis_queue_prefix, *([device] if device else [])])
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from logging import getLogger
|
||||
from threading import Thread
|
||||
from typing_extensions import override
|
||||
|
||||
from tornado.ioloop import IOLoop
|
||||
from tornado.websocket import WebSocketHandler
|
||||
|
@ -24,7 +23,6 @@ class WSRoute(WebSocketHandler, Thread, PubSubMixin, ABC):
|
|||
Thread.__init__(self)
|
||||
self._io_loop = IOLoop.current()
|
||||
|
||||
@override
|
||||
def open(self, *_, **__):
|
||||
auth_status = get_auth_status(self.request)
|
||||
if auth_status != AuthStatus.OK:
|
||||
|
@ -37,11 +35,9 @@ class WSRoute(WebSocketHandler, Thread, PubSubMixin, ABC):
|
|||
self.name = f'ws:{self.app_name()}@{self.request.remote_ip}'
|
||||
self.start()
|
||||
|
||||
@override
|
||||
def data_received(self, *_, **__):
|
||||
pass
|
||||
|
||||
@override
|
||||
def on_message(self, message):
|
||||
return message
|
||||
|
||||
|
@ -63,12 +59,10 @@ class WSRoute(WebSocketHandler, Thread, PubSubMixin, ABC):
|
|||
self.write_message, self._serialize(msg)
|
||||
)
|
||||
|
||||
@override
|
||||
def run(self) -> None:
|
||||
super().run()
|
||||
self.subscribe(*self._subscriptions)
|
||||
|
||||
@override
|
||||
def on_close(self):
|
||||
super().on_close()
|
||||
for channel in self._subscriptions.copy():
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from typing_extensions import override
|
||||
|
||||
from platypush.backend.http.app.mixins import MessageType
|
||||
from platypush.message.event import Event
|
||||
|
||||
|
@ -16,7 +14,6 @@ class WSEventProxy(WSRoute):
|
|||
super().__init__(*args, subscriptions=[self.events_channel], **kwargs)
|
||||
|
||||
@classmethod
|
||||
@override
|
||||
def app_name(cls) -> str:
|
||||
return 'events'
|
||||
|
||||
|
@ -25,12 +22,10 @@ class WSEventProxy(WSRoute):
|
|||
def events_channel(cls) -> str:
|
||||
return cls.get_channel('events')
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def publish(cls, data: MessageType, *_) -> None:
|
||||
super().publish(data, cls.events_channel)
|
||||
|
||||
@override
|
||||
def on_message(self, message):
|
||||
try:
|
||||
event = Event.build(message)
|
||||
|
@ -42,7 +37,6 @@ class WSEventProxy(WSRoute):
|
|||
|
||||
send_message(event, wait_for_response=False)
|
||||
|
||||
@override
|
||||
def run(self) -> None:
|
||||
for msg in self.listen():
|
||||
try:
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from threading import Thread, current_thread
|
||||
from typing import Set
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.backend.http.app.utils import send_message
|
||||
from platypush.message.request import Request
|
||||
|
@ -21,7 +20,6 @@ class WSRequestsProxy(WSRoute):
|
|||
self._requests: Set[Thread] = set()
|
||||
|
||||
@classmethod
|
||||
@override
|
||||
def app_name(cls) -> str:
|
||||
return 'requests'
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
from typing_extensions import override
|
||||
|
||||
from platypush.commands import Command
|
||||
|
||||
|
||||
|
@ -8,7 +6,6 @@ class StopCommand(Command):
|
|||
Stop the application.
|
||||
"""
|
||||
|
||||
@override
|
||||
def __call__(self, app, *_, **__):
|
||||
self.logger.info('Received StopApplication command.')
|
||||
app.stop()
|
||||
|
@ -19,7 +16,6 @@ class RestartCommand(Command):
|
|||
Restart the application.
|
||||
"""
|
||||
|
||||
@override
|
||||
def __call__(self, app, *_, **__):
|
||||
self.logger.info('Received RestartApplication command.')
|
||||
app.restart()
|
||||
|
|
|
@ -4,7 +4,6 @@ from queue import Empty
|
|||
import socket
|
||||
import tempfile
|
||||
from typing import Optional
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.process import ControllableProcess
|
||||
|
||||
|
@ -54,7 +53,6 @@ class CommandStream(ControllableProcess):
|
|||
self._cmd_queue.close()
|
||||
self._cmd_queue = Queue()
|
||||
|
||||
@override
|
||||
def close(self) -> None:
|
||||
self.reset()
|
||||
return super().close()
|
||||
|
@ -134,7 +132,6 @@ class CommandStream(ControllableProcess):
|
|||
except OSError:
|
||||
pass
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
while self._sock and not self.should_stop:
|
||||
sock = self._sock
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from typing import Iterable, List
|
||||
from typing_extensions import override
|
||||
|
||||
from sqlalchemy import (
|
||||
Boolean,
|
||||
|
@ -156,7 +155,6 @@ if 'bluetooth_device' not in Base.metadata:
|
|||
and child.service_class != ServiceClass.UNKNOWN
|
||||
}
|
||||
|
||||
@override
|
||||
def to_dict(self):
|
||||
"""
|
||||
Overwrites ``to_dict`` to transform private column names into their
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from uuid import UUID
|
||||
|
||||
from typing_extensions import override
|
||||
|
||||
from sqlalchemy import (
|
||||
Boolean,
|
||||
Column,
|
||||
|
@ -128,7 +126,6 @@ if 'bluetooth_service' not in Base.metadata:
|
|||
except (TypeError, ValueError):
|
||||
return ServiceClass.UNKNOWN
|
||||
|
||||
@override
|
||||
def to_dict(self) -> dict:
|
||||
return {
|
||||
**{k.lstrip('_'): v for k, v in super().to_dict().items()},
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from typing import Any
|
||||
from typing_extensions import override
|
||||
|
||||
from . import EntityManager
|
||||
|
||||
|
@ -42,7 +41,6 @@ class SwitchEntityManager(WriteableEntityManager, ABC):
|
|||
"""Toggle the state of a device (on->off or off->on)"""
|
||||
raise NotImplementedError()
|
||||
|
||||
@override
|
||||
def set(self, entity: str, value: Any, **kwargs):
|
||||
method = self.on if value else self.off
|
||||
return method(entity, **kwargs)
|
||||
|
|
|
@ -15,7 +15,6 @@ py3-requests
|
|||
py3-rsa
|
||||
py3-sqlalchemy
|
||||
py3-tornado
|
||||
py3-typing-extensions
|
||||
py3-tz
|
||||
py3-websocket-client
|
||||
py3-websockets
|
||||
|
|
|
@ -16,7 +16,6 @@ python3-requests
|
|||
python3-rsa
|
||||
python3-sqlalchemy
|
||||
python3-tornado
|
||||
python3-typing-extensions
|
||||
python3-typing-inspect
|
||||
python3-tz
|
||||
python3-websocket
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import logging
|
||||
import re
|
||||
import sys
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.context import get_backend, get_plugin
|
||||
from platypush.message.event import Event
|
||||
|
@ -104,7 +103,6 @@ class SpeechRecognizedEvent(AssistantEvent):
|
|||
|
||||
return result
|
||||
|
||||
@override
|
||||
def _matches_argument(self, argname, condition_value, event_args, result):
|
||||
"""
|
||||
Overrides the default `_matches_argument` method to allow partial
|
||||
|
|
|
@ -14,7 +14,6 @@ import subprocess
|
|||
import sys
|
||||
import textwrap
|
||||
from typing import IO, Generator, Iterable
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.builder import BaseBuilder
|
||||
from platypush.config import Config
|
||||
|
@ -73,12 +72,10 @@ class DockerBuilder(BaseBuilder):
|
|||
self.tag = tag
|
||||
self.print_only = print_only # TODO
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def get_name(cls):
|
||||
return "platydock"
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def get_description(cls):
|
||||
return "Build a Platypush Docker image from a configuration file."
|
||||
|
@ -133,7 +130,6 @@ class DockerBuilder(BaseBuilder):
|
|||
yield line.rstrip()
|
||||
|
||||
@property
|
||||
@override
|
||||
def deps(self) -> Dependencies:
|
||||
return Dependencies.from_config(
|
||||
self.cfgfile,
|
||||
|
@ -187,7 +183,6 @@ class DockerBuilder(BaseBuilder):
|
|||
|
||||
return parser
|
||||
|
||||
@override
|
||||
def build(self):
|
||||
"""
|
||||
Build a Dockerfile based on a configuration file.
|
||||
|
@ -292,7 +287,6 @@ class DockerBuilder(BaseBuilder):
|
|||
)
|
||||
|
||||
@classmethod
|
||||
@override
|
||||
def _get_arg_parser(cls) -> argparse.ArgumentParser:
|
||||
parser = super()._get_arg_parser()
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ import textwrap
|
|||
from typing import Generator, Sequence
|
||||
import venv
|
||||
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.builder import BaseBuilder
|
||||
from platypush.config import Config
|
||||
from platypush.utils.manifest import (
|
||||
|
@ -36,12 +34,10 @@ class VenvBuilder(BaseBuilder):
|
|||
kwargs['install_context'] = InstallContext.DOCKER
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def get_name(cls):
|
||||
return "platyvenv"
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def get_description(cls):
|
||||
return "Build a Platypush virtual environment from a configuration file."
|
||||
|
|
|
@ -6,7 +6,6 @@ import warnings
|
|||
from abc import ABC, abstractmethod
|
||||
from functools import wraps
|
||||
from typing import Any, Callable, Optional
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.bus import Bus
|
||||
from platypush.common import ExtensionWithManifest
|
||||
|
@ -279,7 +278,6 @@ class AsyncRunnablePlugin(RunnablePlugin, ABC):
|
|||
|
||||
self._task.cancel()
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
if self.should_stop():
|
||||
self.logger.info('The plugin is already scheduled to stop')
|
||||
|
@ -296,7 +294,6 @@ class AsyncRunnablePlugin(RunnablePlugin, ABC):
|
|||
else:
|
||||
self.wait_stop()
|
||||
|
||||
@override
|
||||
def stop(self):
|
||||
if self._loop and self._loop.is_running():
|
||||
self._loop.call_soon_threadsafe(self._loop.stop)
|
||||
|
|
|
@ -2,7 +2,6 @@ import enum
|
|||
import time
|
||||
|
||||
from typing import List, Optional, Dict, Union, Callable, Tuple, Type
|
||||
from typing_extensions import override
|
||||
|
||||
from pyfirmata2 import (
|
||||
Arduino,
|
||||
|
@ -485,7 +484,6 @@ class ArduinoPlugin(SensorPlugin):
|
|||
|
||||
return ret
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: # type: ignore
|
||||
dev_id = 'arduino'
|
||||
dev_name = 'Arduino'
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from typing import Dict, Iterable, Optional, Tuple
|
||||
from typing_extensions import override
|
||||
|
||||
from bleak.backends.device import BLEDevice
|
||||
|
||||
|
@ -15,27 +14,21 @@ class DeviceCache(BaseCache):
|
|||
_by_name: Dict[str, BLEDevice]
|
||||
|
||||
@property
|
||||
@override
|
||||
def _address_field(self) -> str:
|
||||
return 'address'
|
||||
|
||||
@property
|
||||
@override
|
||||
def _name_field(self) -> str:
|
||||
return 'name'
|
||||
|
||||
@override
|
||||
def get(self, device: str) -> Optional[BLEDevice]:
|
||||
return super().get(device)
|
||||
|
||||
@override
|
||||
def add(self, device: BLEDevice) -> BLEDevice:
|
||||
return super().add(device)
|
||||
|
||||
@override
|
||||
def values(self) -> Iterable[BLEDevice]:
|
||||
return super().values()
|
||||
|
||||
@override
|
||||
def items(self) -> Iterable[Tuple[str, BLEDevice]]:
|
||||
return super().items()
|
||||
|
|
|
@ -14,7 +14,6 @@ from typing import (
|
|||
from bleak import BleakClient, BleakScanner
|
||||
from bleak.backends.device import BLEDevice
|
||||
from bleak.exc import BleakError
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.context import get_or_create_event_loop
|
||||
from platypush.entities.bluetooth import BluetoothDevice
|
||||
|
@ -256,7 +255,6 @@ class BLEManager(BaseBluetoothManager):
|
|||
entity.connected = False
|
||||
self.notify(BluetoothDeviceDisconnectedEvent, entity)
|
||||
|
||||
@override
|
||||
def connect(
|
||||
self,
|
||||
device: str,
|
||||
|
@ -299,7 +297,6 @@ class BLEManager(BaseBluetoothManager):
|
|||
success = connected_event.wait(timeout=timeout)
|
||||
assert success, f'Connection to {device} timed out'
|
||||
|
||||
@override
|
||||
def disconnect(self, device: str, *_, **__):
|
||||
# Get the device
|
||||
loop = get_or_create_event_loop()
|
||||
|
@ -323,7 +320,6 @@ class BLEManager(BaseBluetoothManager):
|
|||
connection.thread and connection.thread.is_alive()
|
||||
), f'Disconnection from {device} timed out'
|
||||
|
||||
@override
|
||||
def scan(
|
||||
self,
|
||||
duration: Optional[float] = None,
|
||||
|
@ -340,7 +336,6 @@ class BLEManager(BaseBluetoothManager):
|
|||
loop = get_or_create_event_loop()
|
||||
return loop.run_until_complete(self._scan(duration, service_uuids))
|
||||
|
||||
@override
|
||||
def read(
|
||||
self,
|
||||
device: str,
|
||||
|
@ -360,7 +355,6 @@ class BLEManager(BaseBluetoothManager):
|
|||
self._read(device, service_uuid, interface, connect_timeout)
|
||||
)
|
||||
|
||||
@override
|
||||
def write(
|
||||
self,
|
||||
device: str,
|
||||
|
@ -401,7 +395,6 @@ class BLEManager(BaseBluetoothManager):
|
|||
|
||||
device_addresses = new_device_addresses
|
||||
|
||||
@override
|
||||
def run(self):
|
||||
super().run()
|
||||
|
||||
|
@ -420,7 +413,6 @@ class BLEManager(BaseBluetoothManager):
|
|||
except Exception:
|
||||
pass
|
||||
|
||||
@override
|
||||
def stop(self):
|
||||
"""
|
||||
Upon stop request, it stops any pending scans and closes all active
|
||||
|
|
|
@ -2,8 +2,6 @@ from enum import Enum
|
|||
from typing import Iterable
|
||||
from uuid import UUID
|
||||
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.entities import Entity
|
||||
from platypush.entities.bluetooth import BluetoothDevice
|
||||
from platypush.entities.switches import EnumSwitch
|
||||
|
@ -45,13 +43,11 @@ class SwitchbotPlugin(BaseBluetoothPlugin):
|
|||
Implements support for Switchbot devices.
|
||||
"""
|
||||
|
||||
@override
|
||||
def supports_device(self, device: BluetoothDevice) -> bool:
|
||||
return any(
|
||||
srv.service_class == ServiceClass.SWITCHBOT for srv in device.services
|
||||
)
|
||||
|
||||
@override
|
||||
def _extract_entities(self, device: BluetoothDevice) -> Iterable[Entity]:
|
||||
return [
|
||||
EnumSwitch(
|
||||
|
|
|
@ -2,7 +2,6 @@ from abc import ABC, abstractmethod
|
|||
from collections import defaultdict
|
||||
from threading import RLock
|
||||
from typing import Any, Dict, Iterable, Optional, Tuple, Union
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.entities.bluetooth import BluetoothDevice
|
||||
|
||||
|
@ -95,21 +94,17 @@ class EntityCache(BaseCache):
|
|||
_by_name: Dict[str, BluetoothDevice]
|
||||
|
||||
@property
|
||||
@override
|
||||
def _address_field(self) -> str:
|
||||
return 'address'
|
||||
|
||||
@property
|
||||
@override
|
||||
def _name_field(self) -> str:
|
||||
return 'name'
|
||||
|
||||
@override
|
||||
def get(self, device: Union[str, BluetoothDevice]) -> Optional[BluetoothDevice]:
|
||||
dev_filter = device.address if isinstance(device, BluetoothDevice) else device
|
||||
return super().get(dev_filter)
|
||||
|
||||
@override
|
||||
def add(self, device: BluetoothDevice) -> BluetoothDevice:
|
||||
with self._insert_locks[device.address]:
|
||||
existing_device = self.get(device)
|
||||
|
@ -120,15 +115,12 @@ class EntityCache(BaseCache):
|
|||
|
||||
return super().add(device)
|
||||
|
||||
@override
|
||||
def values(self) -> Iterable[BluetoothDevice]:
|
||||
return super().values()
|
||||
|
||||
@override
|
||||
def items(self) -> Iterable[Tuple[str, BluetoothDevice]]:
|
||||
return super().items()
|
||||
|
||||
@override
|
||||
def __contains__(self, device: Union[str, BluetoothDevice]) -> bool:
|
||||
"""
|
||||
Override the default ``__contains__`` to support lookup by partial
|
||||
|
|
|
@ -10,8 +10,6 @@ from typing import (
|
|||
Optional,
|
||||
Union,
|
||||
)
|
||||
from typing_extensions import override
|
||||
|
||||
import bluetooth
|
||||
|
||||
from platypush.entities.bluetooth import BluetoothDevice, BluetoothService
|
||||
|
@ -193,7 +191,6 @@ class LegacyManager(BaseBluetoothManager):
|
|||
conn.service.connected = False
|
||||
self.notify(BluetoothDeviceDisconnectedEvent, dev)
|
||||
|
||||
@override
|
||||
def connect(
|
||||
self,
|
||||
device: str,
|
||||
|
@ -222,7 +219,6 @@ class LegacyManager(BaseBluetoothManager):
|
|||
conn_success = connected.wait(timeout=timeout)
|
||||
assert conn_success, f'Connection to {device} timed out'
|
||||
|
||||
@override
|
||||
def disconnect(
|
||||
self,
|
||||
device: str,
|
||||
|
@ -241,7 +237,6 @@ class LegacyManager(BaseBluetoothManager):
|
|||
for conn in matching_connections:
|
||||
conn.close()
|
||||
|
||||
@override
|
||||
def scan(self, duration: Optional[float] = None) -> List[BluetoothDevice]:
|
||||
duration = duration or self.poll_interval
|
||||
assert duration, 'Scan duration must be set'
|
||||
|
@ -301,7 +296,6 @@ class LegacyManager(BaseBluetoothManager):
|
|||
|
||||
return list(devices.values())
|
||||
|
||||
@override
|
||||
def read(
|
||||
self,
|
||||
device: str,
|
||||
|
@ -321,7 +315,6 @@ class LegacyManager(BaseBluetoothManager):
|
|||
except bluetooth.BluetoothError as e:
|
||||
raise AssertionError(f'Error reading from {device}: {e}') from e
|
||||
|
||||
@override
|
||||
def write(
|
||||
self,
|
||||
device: str,
|
||||
|
@ -338,7 +331,6 @@ class LegacyManager(BaseBluetoothManager):
|
|||
except bluetooth.BluetoothError as e:
|
||||
raise AssertionError(f'Error reading from {device}: {e}') from e
|
||||
|
||||
@override
|
||||
def run(self):
|
||||
super().run()
|
||||
self.logger.info('Starting legacy Bluetooth scanner')
|
||||
|
@ -348,7 +340,6 @@ class LegacyManager(BaseBluetoothManager):
|
|||
if scan_enabled:
|
||||
self.scan(duration=self.poll_interval)
|
||||
|
||||
@override
|
||||
def stop(self):
|
||||
super().stop()
|
||||
|
||||
|
|
|
@ -15,8 +15,6 @@ from typing import (
|
|||
Type,
|
||||
)
|
||||
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.common import StoppableThread
|
||||
from platypush.context import get_bus, get_plugin
|
||||
from platypush.entities import (
|
||||
|
@ -479,7 +477,6 @@ class BluetoothPlugin(RunnablePlugin, EnumSwitchEntityManager):
|
|||
connect_timeout=connect_timeout,
|
||||
)
|
||||
|
||||
@override
|
||||
@action
|
||||
def set(self, entity: str, value: Any, **_):
|
||||
"""
|
||||
|
@ -549,7 +546,6 @@ class BluetoothPlugin(RunnablePlugin, EnumSwitchEntityManager):
|
|||
sender = FileSender(self._managers[LegacyManager]) # type: ignore
|
||||
sender.send_file(file, device, binary_data)
|
||||
|
||||
@override
|
||||
@action
|
||||
def status(
|
||||
self,
|
||||
|
@ -608,13 +604,11 @@ class BluetoothPlugin(RunnablePlugin, EnumSwitchEntityManager):
|
|||
get_entities_engine().notify(*known_devices)
|
||||
return known_devices
|
||||
|
||||
@override
|
||||
def transform_entities(
|
||||
self, entities: Collection[BluetoothDevice]
|
||||
) -> Collection[BluetoothDevice]:
|
||||
return super().transform_entities(entities)
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
self._refresh_cache()
|
||||
self._init_bluetooth_managers()
|
||||
|
@ -634,7 +628,6 @@ class BluetoothPlugin(RunnablePlugin, EnumSwitchEntityManager):
|
|||
finally:
|
||||
self.stop()
|
||||
|
||||
@override
|
||||
def stop(self):
|
||||
"""
|
||||
Upon stop request, it stops any pending scans and closes all active
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
from typing_extensions import override
|
||||
|
||||
from ._base import Parser
|
||||
|
||||
|
@ -14,7 +13,6 @@ class BackendParser(Parser):
|
|||
r'(\s*):class:`(platypush\.backend\.(.+?))`', re.MULTILINE
|
||||
)
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def parse(cls, docstring: str, *_, **__) -> str:
|
||||
while True:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
from typing_extensions import override
|
||||
|
||||
from ._base import Parser
|
||||
|
||||
|
@ -14,7 +13,6 @@ class EventParser(Parser):
|
|||
r'(\s*):class:`(platypush\.message\.event\.(.+?))`', re.MULTILINE
|
||||
)
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def parse(cls, docstring: str, *_, **__) -> str:
|
||||
while True:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
from typing_extensions import override
|
||||
|
||||
from ._base import Parser
|
||||
|
||||
|
@ -16,7 +15,6 @@ class MethodParser(Parser):
|
|||
|
||||
_rel_method_regex = re.compile(r'(\s*):meth:`\.(.+?)`', re.MULTILINE)
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def parse(cls, docstring: str, obj_type: type) -> str:
|
||||
while True:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
from typing_extensions import override
|
||||
|
||||
from ._base import Parser
|
||||
|
||||
|
@ -14,7 +13,6 @@ class PluginParser(Parser):
|
|||
r'(\s*):class:`(platypush\.plugins\.(.+?))`', re.MULTILINE
|
||||
)
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def parse(cls, docstring: str, *_, **__) -> str:
|
||||
while True:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
from typing_extensions import override
|
||||
|
||||
from ._base import Parser
|
||||
|
||||
|
@ -14,7 +13,6 @@ class ResponseParser(Parser):
|
|||
r'(\s*):class:`(platypush\.message\.response\.(.+?))`', re.MULTILINE
|
||||
)
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def parse(cls, docstring: str, *_, **__) -> str:
|
||||
while True:
|
||||
|
|
|
@ -5,7 +5,6 @@ import os
|
|||
from random import randint
|
||||
import re
|
||||
import textwrap
|
||||
from typing_extensions import override
|
||||
|
||||
from marshmallow import fields
|
||||
|
||||
|
@ -59,7 +58,6 @@ class SchemaParser(Parser):
|
|||
|
||||
return str(field.__class__.__name__).lower()
|
||||
|
||||
@override
|
||||
@classmethod
|
||||
def parse(cls, docstring: str, *_, **__) -> str:
|
||||
while True:
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from typing import Collection, List, Optional
|
||||
|
||||
from typing_extensions import override
|
||||
|
||||
from linode_api4 import LinodeClient, Instance, objects
|
||||
|
||||
from platypush.context import get_bus
|
||||
|
@ -88,7 +86,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
|
|||
if not key.startswith('_')
|
||||
}
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
instances = []
|
||||
|
||||
|
@ -133,7 +130,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
|
|||
instances = new_status.values()
|
||||
self.wait_stop(self.poll_interval)
|
||||
|
||||
@override
|
||||
def transform_entities(
|
||||
self, entities: Collection[LinodeInstance]
|
||||
) -> Collection[CloudInstance]:
|
||||
|
@ -157,7 +153,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
|
|||
)
|
||||
|
||||
@action
|
||||
@override
|
||||
def status(
|
||||
self,
|
||||
*_,
|
||||
|
@ -196,7 +191,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
|
|||
|
||||
return mapped_instances
|
||||
|
||||
@override
|
||||
@action
|
||||
def reboot(self, instance: InstanceId, token: Optional[str] = None, **_):
|
||||
"""
|
||||
|
@ -208,7 +202,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
|
|||
node = self._get_instance(instance=instance, token=token)
|
||||
assert node.reboot(), 'Reboot failed'
|
||||
|
||||
@override
|
||||
@action
|
||||
def boot(self, instance: InstanceId, token: Optional[str] = None, **_):
|
||||
"""
|
||||
|
@ -220,7 +213,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
|
|||
node = self._get_instance(instance=instance, token=token)
|
||||
assert node.boot(), 'Boot failed'
|
||||
|
||||
@override
|
||||
@action
|
||||
def shutdown(self, instance: InstanceId, token: Optional[str] = None, **_):
|
||||
"""
|
||||
|
@ -232,7 +224,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
|
|||
node = self._get_instance(instance=instance, token=token)
|
||||
assert node.shutdown(), 'Shutdown failed'
|
||||
|
||||
@override
|
||||
@action
|
||||
def set(self, entity: str, value: str, **kwargs):
|
||||
"""
|
||||
|
|
|
@ -4,7 +4,6 @@ import io
|
|||
import json
|
||||
import threading
|
||||
from typing import Any, Dict, Iterable, Optional, IO
|
||||
from typing_extensions import override
|
||||
|
||||
import paho.mqtt.client as mqtt
|
||||
|
||||
|
@ -504,7 +503,6 @@ class MqttPlugin(RunnablePlugin):
|
|||
"""
|
||||
return self.publish(*args, **kwargs)
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
if self.run_topic:
|
||||
self.logger.warning(
|
||||
|
@ -519,7 +517,6 @@ class MqttPlugin(RunnablePlugin):
|
|||
|
||||
self.wait_stop()
|
||||
|
||||
@override
|
||||
def stop(self):
|
||||
"""
|
||||
Disconnect all the clients upon plugin stop.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from typing import Collection, Iterable, List, Mapping, Optional, Tuple, Type, Union
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.common.sensors import Numeric, SensorDataType
|
||||
from platypush.context import get_bus
|
||||
|
@ -327,12 +326,10 @@ class SensorPlugin(RunnablePlugin, SensorEntityManager, ABC):
|
|||
|
||||
return {k: v for k, v in data.items() if k in self._enabled_sensors}
|
||||
|
||||
@override
|
||||
@abstractmethod
|
||||
def transform_entities(self, entities: SensorDataType) -> Collection[Entity]:
|
||||
raise NotImplementedError()
|
||||
|
||||
@override
|
||||
def publish_entities(
|
||||
self, entities: SensorDataType, *args, **kwargs
|
||||
) -> Collection[Entity]:
|
||||
|
@ -393,7 +390,6 @@ class SensorPlugin(RunnablePlugin, SensorEntityManager, ABC):
|
|||
self.publish_entities(self._last_measurement)
|
||||
return self._last_measurement
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
sleep_retry_secs = 1 # Exponential back-off
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from dataclasses import dataclass
|
||||
from typing import Dict, List, Type
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.common.sensors import Numeric
|
||||
from platypush.entities.devices import Device
|
||||
|
@ -98,7 +97,6 @@ class SensorBme280Plugin(SensorPlugin):
|
|||
self._device = BME280(i2c_dev=self._bus)
|
||||
return self._device
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(self, *_, **__):
|
||||
"""
|
||||
|
@ -123,7 +121,6 @@ class SensorBme280Plugin(SensorPlugin):
|
|||
'altitude': device.get_altitude(),
|
||||
}
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
|
||||
sensors = []
|
||||
for sensor, value in entities.items():
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
from typing import List, Optional, Dict
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.common.sensors import Numeric
|
||||
from platypush.entities.devices import Device
|
||||
|
||||
from platypush.entities.humidity import HumiditySensor
|
||||
from platypush.entities.temperature import TemperatureSensor
|
||||
from platypush.plugins import action
|
||||
|
@ -101,7 +100,6 @@ class SensorDhtPlugin(SensorPlugin):
|
|||
'temperature': temperature,
|
||||
}
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(self, *_, **__) -> Dict[str, float]:
|
||||
"""
|
||||
|
@ -119,7 +117,6 @@ class SensorDhtPlugin(SensorPlugin):
|
|||
"""
|
||||
return self.read() # type: ignore
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
|
||||
return [
|
||||
Device(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from contextlib import contextmanager
|
||||
from threading import RLock
|
||||
from typing import List, Mapping
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.entities.devices import Device
|
||||
from platypush.entities.distance import DistanceSensor
|
||||
|
@ -65,7 +64,6 @@ class SensorDistanceVl53l1xPlugin(SensorPlugin):
|
|||
self._device.close()
|
||||
self._device = None
|
||||
|
||||
@override
|
||||
def get_measurement(self, *_, short=True, medium=True, long=True, **__):
|
||||
"""
|
||||
:param short: Enable short range measurement (default: True)
|
||||
|
@ -109,7 +107,6 @@ class SensorDistanceVl53l1xPlugin(SensorPlugin):
|
|||
|
||||
return ret
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Mapping[str, int]) -> List[Device]:
|
||||
return [
|
||||
Device(
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from dataclasses import dataclass, field
|
||||
from typing import Any, Dict, List, Optional, Type
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.common.sensors import Numeric
|
||||
from platypush.entities.acceleration import Accelerometer
|
||||
|
@ -99,7 +98,6 @@ class SensorEnvirophatPlugin(SensorPlugin):
|
|||
|
||||
"""
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(self, *_, qnh: float = 1020.0, **__):
|
||||
"""
|
||||
|
@ -156,7 +154,6 @@ class SensorEnvirophatPlugin(SensorPlugin):
|
|||
|
||||
return ret
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
|
||||
return [
|
||||
Device(
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from collections.abc import Collection
|
||||
import time
|
||||
|
||||
from typing import List, Optional, Union
|
||||
from typing_extensions import override
|
||||
import warnings
|
||||
|
||||
from platypush.context import get_bus
|
||||
|
@ -142,7 +140,6 @@ class SensorHcsr04Plugin(GpioPlugin, SensorPlugin):
|
|||
# s = vt where v = 1/2 * avg speed of sound in mm/s
|
||||
return round(pulse_duration * 171500.0, 2)
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(self, *_, **__) -> Optional[float]:
|
||||
"""
|
||||
|
@ -161,7 +158,6 @@ class SensorHcsr04Plugin(GpioPlugin, SensorPlugin):
|
|||
self.cleanup()
|
||||
raise e
|
||||
|
||||
@override
|
||||
def transform_entities(
|
||||
self, entities: Union[Optional[float], Collection[Optional[float]]]
|
||||
) -> List[DistanceSensor]:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from typing import Any, Dict, List
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.entities.acceleration import Accelerometer
|
||||
from platypush.plugins import action
|
||||
|
@ -56,7 +55,6 @@ class SensorLis3dhPlugin(SensorPlugin):
|
|||
self.sensor = LIS3DH()
|
||||
self.sensor.setRange(self.g)
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(self, *_, **__):
|
||||
"""
|
||||
|
@ -74,7 +72,6 @@ class SensorLis3dhPlugin(SensorPlugin):
|
|||
'value': {'x': values[0], 'y': values[1], 'z': values[2]},
|
||||
}
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Dict[str, Any]) -> List[Accelerometer]:
|
||||
return Accelerometer(
|
||||
id='lis3dh',
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from typing import Dict, List
|
||||
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.common.sensors import Numeric
|
||||
from platypush.entities.devices import Device
|
||||
from platypush.entities.distance import DistanceSensor
|
||||
|
@ -35,7 +33,6 @@ class SensorLtr559Plugin(SensorPlugin):
|
|||
super().__init__(**kwargs)
|
||||
self.ltr = ltr559.LTR559()
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(self, *_, **__):
|
||||
"""
|
||||
|
@ -55,7 +52,6 @@ class SensorLtr559Plugin(SensorPlugin):
|
|||
'proximity': self.ltr.get_proximity(),
|
||||
}
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
|
||||
sensors = []
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import enum
|
||||
from typing import Dict, List
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.common.sensors import Numeric
|
||||
from platypush.entities.devices import Device
|
||||
|
@ -154,7 +153,6 @@ class SensorMcp3008Plugin(SensorPlugin):
|
|||
def _convert_to_voltage(self, value):
|
||||
return (value * self.Vdd) / 1023.0 if value is not None else None
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(self):
|
||||
"""
|
||||
|
@ -197,7 +195,6 @@ class SensorMcp3008Plugin(SensorPlugin):
|
|||
|
||||
return values
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
|
||||
return [
|
||||
Device(
|
||||
|
|
|
@ -2,7 +2,6 @@ import enum
|
|||
import math
|
||||
import time
|
||||
from typing import Dict, List
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.common.sensors import Numeric
|
||||
from platypush.entities.devices import Device
|
||||
|
@ -114,7 +113,6 @@ class SensorPmw3901Plugin(SensorPlugin):
|
|||
|
||||
return self._sensor
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(self, *_, **__):
|
||||
"""
|
||||
|
@ -156,7 +154,6 @@ class SensorPmw3901Plugin(SensorPlugin):
|
|||
'motion_events_per_sec': self._events_per_sec.get(secs, 0),
|
||||
}
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
|
||||
return [
|
||||
Device(
|
||||
|
|
|
@ -3,7 +3,6 @@ from collections import namedtuple
|
|||
import json
|
||||
from typing import Dict, List, Optional, Union
|
||||
import threading
|
||||
from typing_extensions import override
|
||||
|
||||
from serial import Serial
|
||||
|
||||
|
@ -258,7 +257,6 @@ class SerialPlugin(SensorPlugin):
|
|||
|
||||
return _DeviceAndRate(device, baud_rate)
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(
|
||||
self,
|
||||
|
@ -386,7 +384,6 @@ class SerialPlugin(SensorPlugin):
|
|||
self.logger.info('Writing %d bytes to %s', len(data), device)
|
||||
ser.write(data)
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
|
||||
transformed_entities = []
|
||||
|
||||
|
@ -415,7 +412,6 @@ class SerialPlugin(SensorPlugin):
|
|||
)
|
||||
]
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
if not self._enable_polling:
|
||||
# If the polling is disabled, we don't need to do anything here
|
||||
|
@ -424,7 +420,6 @@ class SerialPlugin(SensorPlugin):
|
|||
|
||||
super().main()
|
||||
|
||||
@override
|
||||
def stop(self):
|
||||
super().stop()
|
||||
self._close_serial()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from dataclasses import asdict
|
||||
import warnings
|
||||
from typing import Iterable, List, Optional, Union
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.plugins import RunnablePlugin, action
|
||||
|
||||
|
@ -471,7 +470,6 @@ class SoundPlugin(RunnablePlugin):
|
|||
"""
|
||||
self._manager.set_volume(volume=volume, device=device, streams=streams)
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
try:
|
||||
self.wait_stop()
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from typing import Iterable
|
||||
from typing_extensions import override
|
||||
|
||||
from ._base import AudioConverter
|
||||
|
||||
|
@ -10,12 +9,10 @@ class RawInputAudioConverter(AudioConverter):
|
|||
"""
|
||||
|
||||
@property
|
||||
@override
|
||||
def _input_format_args(self) -> Iterable[str]:
|
||||
return self._raw_ffmpeg_args
|
||||
|
||||
@property
|
||||
@override
|
||||
def _output_format_args(self) -> Iterable[str]:
|
||||
return self._compressed_ffmpeg_args
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from typing import Iterable
|
||||
from typing_extensions import override
|
||||
|
||||
from ._base import AudioConverter
|
||||
|
||||
|
@ -10,12 +9,10 @@ class RawOutputAudioConverter(AudioConverter):
|
|||
"""
|
||||
|
||||
@property
|
||||
@override
|
||||
def _input_format_args(self) -> Iterable[str]:
|
||||
return self._compressed_ffmpeg_args
|
||||
|
||||
@property
|
||||
@override
|
||||
def _output_format_args(self) -> Iterable[str]:
|
||||
return self._raw_ffmpeg_args
|
||||
|
||||
|
@ -30,7 +27,6 @@ class RawOutputAudioFromFileConverter(RawOutputAudioConverter):
|
|||
self.infile = infile
|
||||
|
||||
@property
|
||||
@override
|
||||
def _input_source_args(self) -> Iterable[str]:
|
||||
return ('-i', self.infile)
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import queue
|
|||
from threading import Event, RLock, Thread
|
||||
import time
|
||||
from typing import IO, Callable, Final, Generator, Optional, Tuple, Type, Union
|
||||
from typing_extensions import override
|
||||
|
||||
import sounddevice as sd
|
||||
|
||||
|
@ -326,7 +325,6 @@ class AudioThread(Thread, ABC):
|
|||
# Continue only if the converter hasn't terminated
|
||||
return not self._converter_terminated.is_set()
|
||||
|
||||
@override
|
||||
def run(self):
|
||||
"""
|
||||
Wrapper for the main loop that initializes the converter and the stream.
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from abc import ABC
|
||||
from typing import IO, Iterable, List, Optional, Type, Union
|
||||
from typing_extensions import override
|
||||
|
||||
import numpy as np
|
||||
import sounddevice as sd
|
||||
|
@ -55,25 +54,20 @@ class AudioPlayer(AudioThread, ABC):
|
|||
raise AssertionError('Either infile or url must be specified')
|
||||
|
||||
@property
|
||||
@override
|
||||
def direction(self) -> StreamType:
|
||||
return StreamType.OUTPUT
|
||||
|
||||
@override
|
||||
def _on_converter_timeout(self, *_, **__) -> bool:
|
||||
return False # break
|
||||
|
||||
@property
|
||||
@override
|
||||
def _stream_type(self) -> Type[sd.RawOutputStream]:
|
||||
return sd.RawOutputStream
|
||||
|
||||
@property
|
||||
@override
|
||||
def _audio_converter_type(self) -> Type[RawOutputAudioConverter]:
|
||||
return RawOutputAudioConverter
|
||||
|
||||
@override
|
||||
def _on_audio_converted(self, data: bytes, out_f: Optional[IO] = None):
|
||||
if self.audio_stream:
|
||||
self.audio_stream.write(
|
||||
|
@ -87,22 +81,18 @@ class AudioPlayer(AudioThread, ABC):
|
|||
super()._on_audio_converted(data, out_f)
|
||||
|
||||
@property
|
||||
@override
|
||||
def _started_event_type(self) -> Type[SoundPlaybackStartedEvent]:
|
||||
return SoundPlaybackStartedEvent
|
||||
|
||||
@property
|
||||
@override
|
||||
def _stopped_event_type(self) -> Type[SoundPlaybackStoppedEvent]:
|
||||
return SoundPlaybackStoppedEvent
|
||||
|
||||
@property
|
||||
@override
|
||||
def _paused_event_type(self) -> Type[SoundPlaybackPausedEvent]:
|
||||
return SoundPlaybackPausedEvent
|
||||
|
||||
@property
|
||||
@override
|
||||
def _resumed_event_type(self) -> Type[SoundPlaybackResumedEvent]:
|
||||
return SoundPlaybackResumedEvent
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from typing import Optional, Type
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.message.event.sound import SoundEvent
|
||||
|
||||
|
@ -14,12 +13,10 @@ class AudioResourcePlayer(AudioPlayer):
|
|||
"""
|
||||
|
||||
@property
|
||||
@override
|
||||
def _audio_converter_type(self) -> Type[RawOutputAudioFromFileConverter]:
|
||||
return RawOutputAudioFromFileConverter
|
||||
|
||||
@property
|
||||
@override
|
||||
def _converter_args(self) -> dict:
|
||||
return {
|
||||
'infile': self.infile,
|
||||
|
@ -27,11 +24,9 @@ class AudioResourcePlayer(AudioPlayer):
|
|||
}
|
||||
|
||||
@property
|
||||
@override
|
||||
def _converter_stdin(self) -> Optional[int]:
|
||||
return None
|
||||
|
||||
@override
|
||||
def _notify(self, event_type: Type[SoundEvent], **kwargs):
|
||||
return super()._notify(event_type, resource=self.infile, **kwargs)
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import json
|
||||
import logging
|
||||
from typing import List, Tuple, Union
|
||||
from typing_extensions import override
|
||||
|
||||
import numpy as np
|
||||
from numpy.typing import DTypeLike, NDArray
|
||||
|
@ -57,7 +56,6 @@ class Mix(SoundBase):
|
|||
for sound_index in sound_indices[::-1]:
|
||||
self._sounds.pop(sound_index)
|
||||
|
||||
@override
|
||||
def get_wave(
|
||||
self,
|
||||
sample_rate: float,
|
||||
|
|
|
@ -2,7 +2,6 @@ from contextlib import contextmanager
|
|||
from queue import Queue
|
||||
from threading import Event
|
||||
from typing import Any, Generator, Iterable, Optional, Type
|
||||
from typing_extensions import override
|
||||
|
||||
import numpy as np
|
||||
import sounddevice as sd
|
||||
|
@ -42,12 +41,10 @@ class AudioSynthPlayer(AudioPlayer):
|
|||
)
|
||||
|
||||
@property
|
||||
@override
|
||||
def _stream_type(self) -> Type[sd.OutputStream]:
|
||||
return sd.OutputStream
|
||||
|
||||
@property
|
||||
@override
|
||||
def _audio_converter_type(self) -> None:
|
||||
pass
|
||||
|
||||
|
@ -61,7 +58,6 @@ class AudioSynthPlayer(AudioPlayer):
|
|||
self.mix.volume = __value
|
||||
return super().__setattr__(__name, __value)
|
||||
|
||||
@override
|
||||
def _on_converter_timeout(self, *_, **__) -> bool:
|
||||
"""
|
||||
Don't break the audio stream if the output converter failed
|
||||
|
@ -69,7 +65,6 @@ class AudioSynthPlayer(AudioPlayer):
|
|||
return True
|
||||
|
||||
@property
|
||||
@override
|
||||
def _stream_args(self) -> dict:
|
||||
"""
|
||||
Register an :class:`.AudioOutputCallback` to fill up the audio buffers.
|
||||
|
@ -95,7 +90,6 @@ class AudioSynthPlayer(AudioPlayer):
|
|||
"""
|
||||
return self.blocksize * (self.queue_size or 5) / self.sample_rate
|
||||
|
||||
@override
|
||||
@contextmanager
|
||||
def _audio_generator(self) -> Generator[AudioGenerator, None, None]:
|
||||
stop_generator = Event()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from enum import Enum
|
||||
import json
|
||||
from typing import Final, Optional, Tuple, Union
|
||||
from typing_extensions import override
|
||||
|
||||
import numpy as np
|
||||
from numpy.typing import NDArray
|
||||
|
@ -144,7 +143,6 @@ class Sound(SoundBase):
|
|||
|
||||
return wave
|
||||
|
||||
@override
|
||||
def get_wave(
|
||||
self,
|
||||
sample_rate: float,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from typing import Type
|
||||
from typing_extensions import override
|
||||
|
||||
import sounddevice as sd
|
||||
|
||||
|
@ -27,11 +26,9 @@ class AudioRecorder(AudioThread):
|
|||
self.output_format = output_format
|
||||
|
||||
@property
|
||||
@override
|
||||
def direction(self) -> StreamType:
|
||||
return StreamType.INPUT
|
||||
|
||||
@override
|
||||
def _audio_callback(self):
|
||||
# _ = frames
|
||||
# __ = time
|
||||
|
@ -62,32 +59,26 @@ class AudioRecorder(AudioThread):
|
|||
return callback
|
||||
|
||||
@property
|
||||
@override
|
||||
def _audio_converter_type(self) -> Type[RawInputAudioConverter]:
|
||||
return RawInputAudioConverter
|
||||
|
||||
@property
|
||||
@override
|
||||
def _started_event_type(self) -> Type[SoundRecordingStartedEvent]:
|
||||
return SoundRecordingStartedEvent
|
||||
|
||||
@property
|
||||
@override
|
||||
def _stopped_event_type(self) -> Type[SoundRecordingStoppedEvent]:
|
||||
return SoundRecordingStoppedEvent
|
||||
|
||||
@property
|
||||
@override
|
||||
def _paused_event_type(self) -> Type[SoundRecordingPausedEvent]:
|
||||
return SoundRecordingPausedEvent
|
||||
|
||||
@property
|
||||
@override
|
||||
def _resumed_event_type(self) -> Type[SoundRecordingResumedEvent]:
|
||||
return SoundRecordingResumedEvent
|
||||
|
||||
@property
|
||||
@override
|
||||
def _converter_args(self) -> dict:
|
||||
return {
|
||||
'format': self.output_format,
|
||||
|
@ -95,7 +86,6 @@ class AudioRecorder(AudioThread):
|
|||
}
|
||||
|
||||
@property
|
||||
@override
|
||||
def _stream_args(self) -> dict:
|
||||
return {
|
||||
'callback': self._audio_callback(),
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import os
|
||||
|
||||
from typing import Tuple, Union, List, Optional
|
||||
from typing_extensions import override
|
||||
|
||||
import psutil
|
||||
|
||||
|
@ -506,7 +504,6 @@ class SystemPlugin(SensorPlugin, EntityManager):
|
|||
"""
|
||||
self._get_process(pid).wait(timeout)
|
||||
|
||||
@override
|
||||
@action
|
||||
def get_measurement(self, *_, **__):
|
||||
"""
|
||||
|
@ -532,7 +529,6 @@ class SystemPlugin(SensorPlugin, EntityManager):
|
|||
}
|
||||
)
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: dict) -> List[Entity]:
|
||||
cpu = entities['cpu'].copy()
|
||||
battery = entities['battery']
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from functools import wraps
|
||||
from threading import Event, RLock
|
||||
from typing import Any, Callable, Collection, Dict, Iterable, Optional, Union
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.entities import EntityManager, get_entities_engine
|
||||
from platypush.entities.variables import Variable
|
||||
|
@ -170,7 +169,6 @@ class VariablePlugin(Plugin, EntityManager):
|
|||
|
||||
return self._redis.expire(name, expire)
|
||||
|
||||
@override
|
||||
def transform_entities(
|
||||
self, entities: Union[dict, Iterable]
|
||||
) -> Collection[Variable]:
|
||||
|
@ -193,7 +191,6 @@ class VariablePlugin(Plugin, EntityManager):
|
|||
]
|
||||
)
|
||||
|
||||
@override
|
||||
@action
|
||||
@ensure_initialized
|
||||
def status(self, *_, **__):
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import os
|
||||
from typing import Iterable, Optional, Type, Union
|
||||
from typing_extensions import override
|
||||
|
||||
import aioxmpp
|
||||
import aioxmpp.im
|
||||
|
@ -177,11 +176,9 @@ class XmppPlugin(AsyncRunnablePlugin, XmppBasePlugin):
|
|||
|
||||
return self._handlers[hndl_type]
|
||||
|
||||
@override
|
||||
def should_stop(self) -> bool:
|
||||
return super().should_stop() or self._state.should_stop.is_set()
|
||||
|
||||
@override
|
||||
def stop(self):
|
||||
self._state.should_stop.set()
|
||||
self._stop_state_serializer()
|
||||
|
@ -199,7 +196,6 @@ class XmppPlugin(AsyncRunnablePlugin, XmppBasePlugin):
|
|||
self._client.stop()
|
||||
self._client = None
|
||||
|
||||
@override
|
||||
async def listen(self):
|
||||
self._client = aioxmpp.PresenceManagedClient(self._jid, self._security)
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from collections import defaultdict
|
||||
from typing import Type
|
||||
from typing_extensions import override
|
||||
|
||||
from .._base import XmppBasePlugin
|
||||
from ._base import XmppBaseHandler
|
||||
|
@ -15,6 +14,5 @@ class XmppHandlersRegistry(defaultdict):
|
|||
super().__init__()
|
||||
self._plugin = plugin
|
||||
|
||||
@override
|
||||
def __missing__(self, hndl_type: Type[XmppBaseHandler]) -> XmppBaseHandler:
|
||||
return self._plugin.register_handler(hndl_type)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import asyncio
|
||||
from typing import Iterable, Optional, Union
|
||||
from typing_extensions import override
|
||||
|
||||
import aioxmpp
|
||||
import aioxmpp.im
|
||||
|
@ -49,7 +48,6 @@ class XmppRoomHandler(XmppBaseHandler):
|
|||
]
|
||||
)
|
||||
|
||||
@override
|
||||
def restore_state(self):
|
||||
self._async_run(self._restore_state, wait_result=False)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from typing import Union
|
||||
from typing_extensions import override
|
||||
|
||||
import aioxmpp
|
||||
import aioxmpp.roster.xso
|
||||
|
||||
|
@ -28,7 +28,6 @@ class XmppRosterHandler(XmppBaseHandler):
|
|||
self.roster.on_entry_removed.connect(self._on_roster_entry_removed) # type: ignore
|
||||
self.roster.on_subscribe.connect(self._on_roster_subscribe) # type: ignore
|
||||
|
||||
@override
|
||||
def restore_state(self):
|
||||
if self._loaded_state.users:
|
||||
for user_id in self._loaded_state.users:
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from abc import ABC
|
||||
from typing_extensions import override
|
||||
|
||||
from ._events import XmppEventMixin
|
||||
from ._state import XmppStateMixin
|
||||
|
@ -12,7 +11,6 @@ class XmppEventStateMixin(XmppEventMixin, XmppStateMixin, ABC):
|
|||
features to handle events.
|
||||
"""
|
||||
|
||||
@override
|
||||
def _post_event(self, *args, **kwargs):
|
||||
if self._state_serializer:
|
||||
self._state_serializer.enqueue(self._state)
|
||||
|
|
|
@ -15,7 +15,6 @@ from typing import (
|
|||
Type,
|
||||
Union,
|
||||
)
|
||||
from typing_extensions import override
|
||||
|
||||
import paho.mqtt.client as mqtt
|
||||
|
||||
|
@ -313,7 +312,6 @@ class ZigbeeMqttPlugin(
|
|||
if option.get('property')
|
||||
}
|
||||
|
||||
@override
|
||||
def transform_entities(self, entities: Collection[dict]) -> List[Entity]:
|
||||
compatible_entities = []
|
||||
for dev in entities:
|
||||
|
@ -1222,7 +1220,6 @@ class ZigbeeMqttPlugin(
|
|||
|
||||
self.device_set(dev, property, data, **kwargs)
|
||||
|
||||
@override
|
||||
@action
|
||||
def set(self, entity: str, value: Any, attribute: Optional[str] = None, **kwargs):
|
||||
return self.set_value(entity, data=value, property=attribute, **kwargs)
|
||||
|
@ -2136,7 +2133,6 @@ class ZigbeeMqttPlugin(
|
|||
|
||||
self.device_set(self._preferred_name(dev), values=data)
|
||||
|
||||
@override
|
||||
def on_mqtt_message(self):
|
||||
"""
|
||||
Overrides :meth:`platypush.plugins.mqtt.MqttPlugin.on_mqtt_message` to
|
||||
|
|
|
@ -21,8 +21,6 @@ from typing import (
|
|||
)
|
||||
from urllib.parse import parse_qs, urlparse
|
||||
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.entities import (
|
||||
DimmerEntityManager,
|
||||
EnumSwitchEntityManager,
|
||||
|
@ -958,7 +956,6 @@ class ZwaveMqttPlugin(
|
|||
assert group_id in groups, f'No such group_id: {group_id}'
|
||||
return groups[group_id]
|
||||
|
||||
@override
|
||||
def on_mqtt_message(self):
|
||||
def handler(_, __, msg):
|
||||
if not msg.topic.startswith(self.events_topic):
|
||||
|
@ -2189,7 +2186,6 @@ class ZwaveMqttPlugin(
|
|||
'id': value['value_id'],
|
||||
}
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
self.get_nodes()
|
||||
super().main()
|
||||
|
|
|
@ -3,7 +3,6 @@ import logging
|
|||
from multiprocessing import Event, Process, RLock
|
||||
from os import getpid
|
||||
from typing import Optional
|
||||
from typing_extensions import override
|
||||
|
||||
|
||||
class ControllableProcess(Process, ABC):
|
||||
|
@ -121,7 +120,6 @@ class ControllableProcess(Process, ABC):
|
|||
self._should_restart = False
|
||||
return self.main()
|
||||
|
||||
@override
|
||||
def run(self) -> None:
|
||||
"""
|
||||
Executes the process.
|
||||
|
|
|
@ -3,7 +3,6 @@ import os
|
|||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
from typing_extensions import override
|
||||
|
||||
from platypush.process import ControllableProcess
|
||||
|
||||
|
@ -27,7 +26,6 @@ class ApplicationProcess(ControllableProcess):
|
|||
def __exit__(self, *_, **__):
|
||||
self.stop()
|
||||
|
||||
@override
|
||||
def main(self):
|
||||
self.logger.info('Starting application...')
|
||||
|
||||
|
@ -42,7 +40,6 @@ class ApplicationProcess(ControllableProcess):
|
|||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
@override
|
||||
def on_stop(self):
|
||||
try:
|
||||
with open(self.pidfile, 'r') as f:
|
||||
|
|
|
@ -25,7 +25,6 @@ from typing import (
|
|||
Type,
|
||||
Union,
|
||||
)
|
||||
from typing_extensions import override
|
||||
|
||||
import yaml
|
||||
|
||||
|
@ -551,7 +550,6 @@ class PluginManifest(Manifest):
|
|||
"""
|
||||
|
||||
@property
|
||||
@override
|
||||
def manifest_type(self) -> ManifestType:
|
||||
return ManifestType.PLUGIN
|
||||
|
||||
|
@ -563,7 +561,6 @@ class BackendManifest(Manifest):
|
|||
"""
|
||||
|
||||
@property
|
||||
@override
|
||||
def manifest_type(self) -> ManifestType:
|
||||
return ManifestType.BACKEND
|
||||
|
||||
|
|
Loading…
Reference in a new issue