Removed typing-extensions dependency.

The package isn't present on older versions of Debian.
This commit is contained in:
Fabio Manganiello 2023-09-18 14:05:39 +02:00
parent 10bf617261
commit 3e8d6bb01e
65 changed files with 2 additions and 243 deletions

View file

@ -3,7 +3,6 @@ from http.client import responses
import json import json
from logging import getLogger from logging import getLogger
from typing import Optional from typing import Optional
from typing_extensions import override
from tornado.web import RequestHandler, stream_request_body from tornado.web import RequestHandler, stream_request_body
@ -22,7 +21,6 @@ class StreamingRoute(RequestHandler, PubSubMixin, ABC):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.logger = getLogger(__name__) self.logger = getLogger(__name__)
@override
def prepare(self): def prepare(self):
""" """
Request preparation logic. It performs user authentication if 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 'Client %s connected to %s', self.request.remote_ip, self.request.path
) )
@override
def write_error(self, status_code: int, error: Optional[str] = None, **_): def write_error(self, status_code: int, error: Optional[str] = None, **_):
""" """
Make sure that errors are always returned in JSON format. Make sure that errors are always returned in JSON format.

View file

@ -1,7 +1,6 @@
from enum import Enum from enum import Enum
import json import json
from typing import Optional from typing import Optional
from typing_extensions import override
from tornado.web import stream_request_body from tornado.web import stream_request_body
from platypush.context import get_plugin from platypush.context import get_plugin
@ -37,7 +36,6 @@ class CameraRoute(StreamingRoute):
self._request_type = RequestType.UNKNOWN self._request_type = RequestType.UNKNOWN
self._extension: str = '' self._extension: str = ''
@override
@classmethod @classmethod
def path(cls) -> str: def path(cls) -> str:
return r"/camera/([a-zA-Z0-9_./]+)/([a-zA-Z0-9_]+)\.?([a-zA-Z0-9_]+)?" return r"/camera/([a-zA-Z0-9_./]+)/([a-zA-Z0-9_]+)\.?([a-zA-Z0-9_]+)?"
@ -95,7 +93,6 @@ class CameraRoute(StreamingRoute):
return kwargs return kwargs
@override
@classmethod @classmethod
def _get_redis_queue(cls, camera: CameraPlugin, *_, **__) -> str: def _get_redis_queue(cls, camera: CameraPlugin, *_, **__) -> str:
plugin_name = get_plugin_name_by_class(camera.__class__) plugin_name = get_plugin_name_by_class(camera.__class__)

View file

@ -1,7 +1,6 @@
from contextlib import contextmanager from contextlib import contextmanager
import json import json
from typing import Generator, Optional from typing import Generator, Optional
from typing_extensions import override
from tornado.web import stream_request_body from tornado.web import stream_request_body
@ -24,7 +23,6 @@ class SoundRoute(StreamingRoute):
self._audio_headers_written: bool = False self._audio_headers_written: bool = False
"""Send the audio file headers before we send the first audio frame.""" """Send the audio file headers before we send the first audio frame."""
@override
@classmethod @classmethod
def path(cls) -> str: def path(cls) -> str:
return r"/sound/stream\.?([a-zA-Z0-9_]+)?" return r"/sound/stream\.?([a-zA-Z0-9_]+)?"
@ -44,7 +42,6 @@ class SoundRoute(StreamingRoute):
yield yield
send_request('sound.stop_recording') send_request('sound.stop_recording')
@override
@classmethod @classmethod
def _get_redis_queue(cls, *_, device: Optional[str] = None, **__) -> str: def _get_redis_queue(cls, *_, device: Optional[str] = None, **__) -> str:
return '/'.join([cls._redis_queue_prefix, *([device] if device else [])]) return '/'.join([cls._redis_queue_prefix, *([device] if device else [])])

View file

@ -1,7 +1,6 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from logging import getLogger from logging import getLogger
from threading import Thread from threading import Thread
from typing_extensions import override
from tornado.ioloop import IOLoop from tornado.ioloop import IOLoop
from tornado.websocket import WebSocketHandler from tornado.websocket import WebSocketHandler
@ -24,7 +23,6 @@ class WSRoute(WebSocketHandler, Thread, PubSubMixin, ABC):
Thread.__init__(self) Thread.__init__(self)
self._io_loop = IOLoop.current() self._io_loop = IOLoop.current()
@override
def open(self, *_, **__): def open(self, *_, **__):
auth_status = get_auth_status(self.request) auth_status = get_auth_status(self.request)
if auth_status != AuthStatus.OK: 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.name = f'ws:{self.app_name()}@{self.request.remote_ip}'
self.start() self.start()
@override
def data_received(self, *_, **__): def data_received(self, *_, **__):
pass pass
@override
def on_message(self, message): def on_message(self, message):
return message return message
@ -63,12 +59,10 @@ class WSRoute(WebSocketHandler, Thread, PubSubMixin, ABC):
self.write_message, self._serialize(msg) self.write_message, self._serialize(msg)
) )
@override
def run(self) -> None: def run(self) -> None:
super().run() super().run()
self.subscribe(*self._subscriptions) self.subscribe(*self._subscriptions)
@override
def on_close(self): def on_close(self):
super().on_close() super().on_close()
for channel in self._subscriptions.copy(): for channel in self._subscriptions.copy():

View file

@ -1,5 +1,3 @@
from typing_extensions import override
from platypush.backend.http.app.mixins import MessageType from platypush.backend.http.app.mixins import MessageType
from platypush.message.event import Event from platypush.message.event import Event
@ -16,7 +14,6 @@ class WSEventProxy(WSRoute):
super().__init__(*args, subscriptions=[self.events_channel], **kwargs) super().__init__(*args, subscriptions=[self.events_channel], **kwargs)
@classmethod @classmethod
@override
def app_name(cls) -> str: def app_name(cls) -> str:
return 'events' return 'events'
@ -25,12 +22,10 @@ class WSEventProxy(WSRoute):
def events_channel(cls) -> str: def events_channel(cls) -> str:
return cls.get_channel('events') return cls.get_channel('events')
@override
@classmethod @classmethod
def publish(cls, data: MessageType, *_) -> None: def publish(cls, data: MessageType, *_) -> None:
super().publish(data, cls.events_channel) super().publish(data, cls.events_channel)
@override
def on_message(self, message): def on_message(self, message):
try: try:
event = Event.build(message) event = Event.build(message)
@ -42,7 +37,6 @@ class WSEventProxy(WSRoute):
send_message(event, wait_for_response=False) send_message(event, wait_for_response=False)
@override
def run(self) -> None: def run(self) -> None:
for msg in self.listen(): for msg in self.listen():
try: try:

View file

@ -1,6 +1,5 @@
from threading import Thread, current_thread from threading import Thread, current_thread
from typing import Set from typing import Set
from typing_extensions import override
from platypush.backend.http.app.utils import send_message from platypush.backend.http.app.utils import send_message
from platypush.message.request import Request from platypush.message.request import Request
@ -21,7 +20,6 @@ class WSRequestsProxy(WSRoute):
self._requests: Set[Thread] = set() self._requests: Set[Thread] = set()
@classmethod @classmethod
@override
def app_name(cls) -> str: def app_name(cls) -> str:
return 'requests' return 'requests'

View file

@ -1,5 +1,3 @@
from typing_extensions import override
from platypush.commands import Command from platypush.commands import Command
@ -8,7 +6,6 @@ class StopCommand(Command):
Stop the application. Stop the application.
""" """
@override
def __call__(self, app, *_, **__): def __call__(self, app, *_, **__):
self.logger.info('Received StopApplication command.') self.logger.info('Received StopApplication command.')
app.stop() app.stop()
@ -19,7 +16,6 @@ class RestartCommand(Command):
Restart the application. Restart the application.
""" """
@override
def __call__(self, app, *_, **__): def __call__(self, app, *_, **__):
self.logger.info('Received RestartApplication command.') self.logger.info('Received RestartApplication command.')
app.restart() app.restart()

View file

@ -4,7 +4,6 @@ from queue import Empty
import socket import socket
import tempfile import tempfile
from typing import Optional from typing import Optional
from typing_extensions import override
from platypush.process import ControllableProcess from platypush.process import ControllableProcess
@ -54,7 +53,6 @@ class CommandStream(ControllableProcess):
self._cmd_queue.close() self._cmd_queue.close()
self._cmd_queue = Queue() self._cmd_queue = Queue()
@override
def close(self) -> None: def close(self) -> None:
self.reset() self.reset()
return super().close() return super().close()
@ -134,7 +132,6 @@ class CommandStream(ControllableProcess):
except OSError: except OSError:
pass pass
@override
def main(self): def main(self):
while self._sock and not self.should_stop: while self._sock and not self.should_stop:
sock = self._sock sock = self._sock

View file

@ -1,5 +1,4 @@
from typing import Iterable, List from typing import Iterable, List
from typing_extensions import override
from sqlalchemy import ( from sqlalchemy import (
Boolean, Boolean,
@ -156,7 +155,6 @@ if 'bluetooth_device' not in Base.metadata:
and child.service_class != ServiceClass.UNKNOWN and child.service_class != ServiceClass.UNKNOWN
} }
@override
def to_dict(self): def to_dict(self):
""" """
Overwrites ``to_dict`` to transform private column names into their Overwrites ``to_dict`` to transform private column names into their

View file

@ -1,7 +1,5 @@
from uuid import UUID from uuid import UUID
from typing_extensions import override
from sqlalchemy import ( from sqlalchemy import (
Boolean, Boolean,
Column, Column,
@ -128,7 +126,6 @@ if 'bluetooth_service' not in Base.metadata:
except (TypeError, ValueError): except (TypeError, ValueError):
return ServiceClass.UNKNOWN return ServiceClass.UNKNOWN
@override
def to_dict(self) -> dict: def to_dict(self) -> dict:
return { return {
**{k.lstrip('_'): v for k, v in super().to_dict().items()}, **{k.lstrip('_'): v for k, v in super().to_dict().items()},

View file

@ -1,6 +1,5 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import Any from typing import Any
from typing_extensions import override
from . import EntityManager from . import EntityManager
@ -42,7 +41,6 @@ class SwitchEntityManager(WriteableEntityManager, ABC):
"""Toggle the state of a device (on->off or off->on)""" """Toggle the state of a device (on->off or off->on)"""
raise NotImplementedError() raise NotImplementedError()
@override
def set(self, entity: str, value: Any, **kwargs): def set(self, entity: str, value: Any, **kwargs):
method = self.on if value else self.off method = self.on if value else self.off
return method(entity, **kwargs) return method(entity, **kwargs)

View file

@ -15,7 +15,6 @@ py3-requests
py3-rsa py3-rsa
py3-sqlalchemy py3-sqlalchemy
py3-tornado py3-tornado
py3-typing-extensions
py3-tz py3-tz
py3-websocket-client py3-websocket-client
py3-websockets py3-websockets

View file

@ -16,7 +16,6 @@ python3-requests
python3-rsa python3-rsa
python3-sqlalchemy python3-sqlalchemy
python3-tornado python3-tornado
python3-typing-extensions
python3-typing-inspect python3-typing-inspect
python3-tz python3-tz
python3-websocket python3-websocket

View file

@ -1,7 +1,6 @@
import logging import logging
import re import re
import sys import sys
from typing_extensions import override
from platypush.context import get_backend, get_plugin from platypush.context import get_backend, get_plugin
from platypush.message.event import Event from platypush.message.event import Event
@ -104,7 +103,6 @@ class SpeechRecognizedEvent(AssistantEvent):
return result return result
@override
def _matches_argument(self, argname, condition_value, event_args, result): def _matches_argument(self, argname, condition_value, event_args, result):
""" """
Overrides the default `_matches_argument` method to allow partial Overrides the default `_matches_argument` method to allow partial

View file

@ -14,7 +14,6 @@ import subprocess
import sys import sys
import textwrap import textwrap
from typing import IO, Generator, Iterable from typing import IO, Generator, Iterable
from typing_extensions import override
from platypush.builder import BaseBuilder from platypush.builder import BaseBuilder
from platypush.config import Config from platypush.config import Config
@ -73,12 +72,10 @@ class DockerBuilder(BaseBuilder):
self.tag = tag self.tag = tag
self.print_only = print_only # TODO self.print_only = print_only # TODO
@override
@classmethod @classmethod
def get_name(cls): def get_name(cls):
return "platydock" return "platydock"
@override
@classmethod @classmethod
def get_description(cls): def get_description(cls):
return "Build a Platypush Docker image from a configuration file." return "Build a Platypush Docker image from a configuration file."
@ -133,7 +130,6 @@ class DockerBuilder(BaseBuilder):
yield line.rstrip() yield line.rstrip()
@property @property
@override
def deps(self) -> Dependencies: def deps(self) -> Dependencies:
return Dependencies.from_config( return Dependencies.from_config(
self.cfgfile, self.cfgfile,
@ -187,7 +183,6 @@ class DockerBuilder(BaseBuilder):
return parser return parser
@override
def build(self): def build(self):
""" """
Build a Dockerfile based on a configuration file. Build a Dockerfile based on a configuration file.
@ -292,7 +287,6 @@ class DockerBuilder(BaseBuilder):
) )
@classmethod @classmethod
@override
def _get_arg_parser(cls) -> argparse.ArgumentParser: def _get_arg_parser(cls) -> argparse.ArgumentParser:
parser = super()._get_arg_parser() parser = super()._get_arg_parser()

View file

@ -15,8 +15,6 @@ import textwrap
from typing import Generator, Sequence from typing import Generator, Sequence
import venv import venv
from typing_extensions import override
from platypush.builder import BaseBuilder from platypush.builder import BaseBuilder
from platypush.config import Config from platypush.config import Config
from platypush.utils.manifest import ( from platypush.utils.manifest import (
@ -36,12 +34,10 @@ class VenvBuilder(BaseBuilder):
kwargs['install_context'] = InstallContext.DOCKER kwargs['install_context'] = InstallContext.DOCKER
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@override
@classmethod @classmethod
def get_name(cls): def get_name(cls):
return "platyvenv" return "platyvenv"
@override
@classmethod @classmethod
def get_description(cls): def get_description(cls):
return "Build a Platypush virtual environment from a configuration file." return "Build a Platypush virtual environment from a configuration file."

View file

@ -6,7 +6,6 @@ import warnings
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from functools import wraps from functools import wraps
from typing import Any, Callable, Optional from typing import Any, Callable, Optional
from typing_extensions import override
from platypush.bus import Bus from platypush.bus import Bus
from platypush.common import ExtensionWithManifest from platypush.common import ExtensionWithManifest
@ -279,7 +278,6 @@ class AsyncRunnablePlugin(RunnablePlugin, ABC):
self._task.cancel() self._task.cancel()
@override
def main(self): def main(self):
if self.should_stop(): if self.should_stop():
self.logger.info('The plugin is already scheduled to stop') self.logger.info('The plugin is already scheduled to stop')
@ -296,7 +294,6 @@ class AsyncRunnablePlugin(RunnablePlugin, ABC):
else: else:
self.wait_stop() self.wait_stop()
@override
def stop(self): def stop(self):
if self._loop and self._loop.is_running(): if self._loop and self._loop.is_running():
self._loop.call_soon_threadsafe(self._loop.stop) self._loop.call_soon_threadsafe(self._loop.stop)

View file

@ -2,7 +2,6 @@ import enum
import time import time
from typing import List, Optional, Dict, Union, Callable, Tuple, Type from typing import List, Optional, Dict, Union, Callable, Tuple, Type
from typing_extensions import override
from pyfirmata2 import ( from pyfirmata2 import (
Arduino, Arduino,
@ -485,7 +484,6 @@ class ArduinoPlugin(SensorPlugin):
return ret return ret
@override
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: # type: ignore def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: # type: ignore
dev_id = 'arduino' dev_id = 'arduino'
dev_name = 'Arduino' dev_name = 'Arduino'

View file

@ -1,5 +1,4 @@
from typing import Dict, Iterable, Optional, Tuple from typing import Dict, Iterable, Optional, Tuple
from typing_extensions import override
from bleak.backends.device import BLEDevice from bleak.backends.device import BLEDevice
@ -15,27 +14,21 @@ class DeviceCache(BaseCache):
_by_name: Dict[str, BLEDevice] _by_name: Dict[str, BLEDevice]
@property @property
@override
def _address_field(self) -> str: def _address_field(self) -> str:
return 'address' return 'address'
@property @property
@override
def _name_field(self) -> str: def _name_field(self) -> str:
return 'name' return 'name'
@override
def get(self, device: str) -> Optional[BLEDevice]: def get(self, device: str) -> Optional[BLEDevice]:
return super().get(device) return super().get(device)
@override
def add(self, device: BLEDevice) -> BLEDevice: def add(self, device: BLEDevice) -> BLEDevice:
return super().add(device) return super().add(device)
@override
def values(self) -> Iterable[BLEDevice]: def values(self) -> Iterable[BLEDevice]:
return super().values() return super().values()
@override
def items(self) -> Iterable[Tuple[str, BLEDevice]]: def items(self) -> Iterable[Tuple[str, BLEDevice]]:
return super().items() return super().items()

View file

@ -14,7 +14,6 @@ from typing import (
from bleak import BleakClient, BleakScanner from bleak import BleakClient, BleakScanner
from bleak.backends.device import BLEDevice from bleak.backends.device import BLEDevice
from bleak.exc import BleakError from bleak.exc import BleakError
from typing_extensions import override
from platypush.context import get_or_create_event_loop from platypush.context import get_or_create_event_loop
from platypush.entities.bluetooth import BluetoothDevice from platypush.entities.bluetooth import BluetoothDevice
@ -256,7 +255,6 @@ class BLEManager(BaseBluetoothManager):
entity.connected = False entity.connected = False
self.notify(BluetoothDeviceDisconnectedEvent, entity) self.notify(BluetoothDeviceDisconnectedEvent, entity)
@override
def connect( def connect(
self, self,
device: str, device: str,
@ -299,7 +297,6 @@ class BLEManager(BaseBluetoothManager):
success = connected_event.wait(timeout=timeout) success = connected_event.wait(timeout=timeout)
assert success, f'Connection to {device} timed out' assert success, f'Connection to {device} timed out'
@override
def disconnect(self, device: str, *_, **__): def disconnect(self, device: str, *_, **__):
# Get the device # Get the device
loop = get_or_create_event_loop() loop = get_or_create_event_loop()
@ -323,7 +320,6 @@ class BLEManager(BaseBluetoothManager):
connection.thread and connection.thread.is_alive() connection.thread and connection.thread.is_alive()
), f'Disconnection from {device} timed out' ), f'Disconnection from {device} timed out'
@override
def scan( def scan(
self, self,
duration: Optional[float] = None, duration: Optional[float] = None,
@ -340,7 +336,6 @@ class BLEManager(BaseBluetoothManager):
loop = get_or_create_event_loop() loop = get_or_create_event_loop()
return loop.run_until_complete(self._scan(duration, service_uuids)) return loop.run_until_complete(self._scan(duration, service_uuids))
@override
def read( def read(
self, self,
device: str, device: str,
@ -360,7 +355,6 @@ class BLEManager(BaseBluetoothManager):
self._read(device, service_uuid, interface, connect_timeout) self._read(device, service_uuid, interface, connect_timeout)
) )
@override
def write( def write(
self, self,
device: str, device: str,
@ -401,7 +395,6 @@ class BLEManager(BaseBluetoothManager):
device_addresses = new_device_addresses device_addresses = new_device_addresses
@override
def run(self): def run(self):
super().run() super().run()
@ -420,7 +413,6 @@ class BLEManager(BaseBluetoothManager):
except Exception: except Exception:
pass pass
@override
def stop(self): def stop(self):
""" """
Upon stop request, it stops any pending scans and closes all active Upon stop request, it stops any pending scans and closes all active

View file

@ -2,8 +2,6 @@ from enum import Enum
from typing import Iterable from typing import Iterable
from uuid import UUID from uuid import UUID
from typing_extensions import override
from platypush.entities import Entity from platypush.entities import Entity
from platypush.entities.bluetooth import BluetoothDevice from platypush.entities.bluetooth import BluetoothDevice
from platypush.entities.switches import EnumSwitch from platypush.entities.switches import EnumSwitch
@ -45,13 +43,11 @@ class SwitchbotPlugin(BaseBluetoothPlugin):
Implements support for Switchbot devices. Implements support for Switchbot devices.
""" """
@override
def supports_device(self, device: BluetoothDevice) -> bool: def supports_device(self, device: BluetoothDevice) -> bool:
return any( return any(
srv.service_class == ServiceClass.SWITCHBOT for srv in device.services srv.service_class == ServiceClass.SWITCHBOT for srv in device.services
) )
@override
def _extract_entities(self, device: BluetoothDevice) -> Iterable[Entity]: def _extract_entities(self, device: BluetoothDevice) -> Iterable[Entity]:
return [ return [
EnumSwitch( EnumSwitch(

View file

@ -2,7 +2,6 @@ from abc import ABC, abstractmethod
from collections import defaultdict from collections import defaultdict
from threading import RLock from threading import RLock
from typing import Any, Dict, Iterable, Optional, Tuple, Union from typing import Any, Dict, Iterable, Optional, Tuple, Union
from typing_extensions import override
from platypush.entities.bluetooth import BluetoothDevice from platypush.entities.bluetooth import BluetoothDevice
@ -95,21 +94,17 @@ class EntityCache(BaseCache):
_by_name: Dict[str, BluetoothDevice] _by_name: Dict[str, BluetoothDevice]
@property @property
@override
def _address_field(self) -> str: def _address_field(self) -> str:
return 'address' return 'address'
@property @property
@override
def _name_field(self) -> str: def _name_field(self) -> str:
return 'name' return 'name'
@override
def get(self, device: Union[str, BluetoothDevice]) -> Optional[BluetoothDevice]: def get(self, device: Union[str, BluetoothDevice]) -> Optional[BluetoothDevice]:
dev_filter = device.address if isinstance(device, BluetoothDevice) else device dev_filter = device.address if isinstance(device, BluetoothDevice) else device
return super().get(dev_filter) return super().get(dev_filter)
@override
def add(self, device: BluetoothDevice) -> BluetoothDevice: def add(self, device: BluetoothDevice) -> BluetoothDevice:
with self._insert_locks[device.address]: with self._insert_locks[device.address]:
existing_device = self.get(device) existing_device = self.get(device)
@ -120,15 +115,12 @@ class EntityCache(BaseCache):
return super().add(device) return super().add(device)
@override
def values(self) -> Iterable[BluetoothDevice]: def values(self) -> Iterable[BluetoothDevice]:
return super().values() return super().values()
@override
def items(self) -> Iterable[Tuple[str, BluetoothDevice]]: def items(self) -> Iterable[Tuple[str, BluetoothDevice]]:
return super().items() return super().items()
@override
def __contains__(self, device: Union[str, BluetoothDevice]) -> bool: def __contains__(self, device: Union[str, BluetoothDevice]) -> bool:
""" """
Override the default ``__contains__`` to support lookup by partial Override the default ``__contains__`` to support lookup by partial

View file

@ -10,8 +10,6 @@ from typing import (
Optional, Optional,
Union, Union,
) )
from typing_extensions import override
import bluetooth import bluetooth
from platypush.entities.bluetooth import BluetoothDevice, BluetoothService from platypush.entities.bluetooth import BluetoothDevice, BluetoothService
@ -193,7 +191,6 @@ class LegacyManager(BaseBluetoothManager):
conn.service.connected = False conn.service.connected = False
self.notify(BluetoothDeviceDisconnectedEvent, dev) self.notify(BluetoothDeviceDisconnectedEvent, dev)
@override
def connect( def connect(
self, self,
device: str, device: str,
@ -222,7 +219,6 @@ class LegacyManager(BaseBluetoothManager):
conn_success = connected.wait(timeout=timeout) conn_success = connected.wait(timeout=timeout)
assert conn_success, f'Connection to {device} timed out' assert conn_success, f'Connection to {device} timed out'
@override
def disconnect( def disconnect(
self, self,
device: str, device: str,
@ -241,7 +237,6 @@ class LegacyManager(BaseBluetoothManager):
for conn in matching_connections: for conn in matching_connections:
conn.close() conn.close()
@override
def scan(self, duration: Optional[float] = None) -> List[BluetoothDevice]: def scan(self, duration: Optional[float] = None) -> List[BluetoothDevice]:
duration = duration or self.poll_interval duration = duration or self.poll_interval
assert duration, 'Scan duration must be set' assert duration, 'Scan duration must be set'
@ -301,7 +296,6 @@ class LegacyManager(BaseBluetoothManager):
return list(devices.values()) return list(devices.values())
@override
def read( def read(
self, self,
device: str, device: str,
@ -321,7 +315,6 @@ class LegacyManager(BaseBluetoothManager):
except bluetooth.BluetoothError as e: except bluetooth.BluetoothError as e:
raise AssertionError(f'Error reading from {device}: {e}') from e raise AssertionError(f'Error reading from {device}: {e}') from e
@override
def write( def write(
self, self,
device: str, device: str,
@ -338,7 +331,6 @@ class LegacyManager(BaseBluetoothManager):
except bluetooth.BluetoothError as e: except bluetooth.BluetoothError as e:
raise AssertionError(f'Error reading from {device}: {e}') from e raise AssertionError(f'Error reading from {device}: {e}') from e
@override
def run(self): def run(self):
super().run() super().run()
self.logger.info('Starting legacy Bluetooth scanner') self.logger.info('Starting legacy Bluetooth scanner')
@ -348,7 +340,6 @@ class LegacyManager(BaseBluetoothManager):
if scan_enabled: if scan_enabled:
self.scan(duration=self.poll_interval) self.scan(duration=self.poll_interval)
@override
def stop(self): def stop(self):
super().stop() super().stop()

View file

@ -15,8 +15,6 @@ from typing import (
Type, Type,
) )
from typing_extensions import override
from platypush.common import StoppableThread from platypush.common import StoppableThread
from platypush.context import get_bus, get_plugin from platypush.context import get_bus, get_plugin
from platypush.entities import ( from platypush.entities import (
@ -479,7 +477,6 @@ class BluetoothPlugin(RunnablePlugin, EnumSwitchEntityManager):
connect_timeout=connect_timeout, connect_timeout=connect_timeout,
) )
@override
@action @action
def set(self, entity: str, value: Any, **_): def set(self, entity: str, value: Any, **_):
""" """
@ -549,7 +546,6 @@ class BluetoothPlugin(RunnablePlugin, EnumSwitchEntityManager):
sender = FileSender(self._managers[LegacyManager]) # type: ignore sender = FileSender(self._managers[LegacyManager]) # type: ignore
sender.send_file(file, device, binary_data) sender.send_file(file, device, binary_data)
@override
@action @action
def status( def status(
self, self,
@ -608,13 +604,11 @@ class BluetoothPlugin(RunnablePlugin, EnumSwitchEntityManager):
get_entities_engine().notify(*known_devices) get_entities_engine().notify(*known_devices)
return known_devices return known_devices
@override
def transform_entities( def transform_entities(
self, entities: Collection[BluetoothDevice] self, entities: Collection[BluetoothDevice]
) -> Collection[BluetoothDevice]: ) -> Collection[BluetoothDevice]:
return super().transform_entities(entities) return super().transform_entities(entities)
@override
def main(self): def main(self):
self._refresh_cache() self._refresh_cache()
self._init_bluetooth_managers() self._init_bluetooth_managers()
@ -634,7 +628,6 @@ class BluetoothPlugin(RunnablePlugin, EnumSwitchEntityManager):
finally: finally:
self.stop() self.stop()
@override
def stop(self): def stop(self):
""" """
Upon stop request, it stops any pending scans and closes all active Upon stop request, it stops any pending scans and closes all active

View file

@ -1,5 +1,4 @@
import re import re
from typing_extensions import override
from ._base import Parser from ._base import Parser
@ -14,7 +13,6 @@ class BackendParser(Parser):
r'(\s*):class:`(platypush\.backend\.(.+?))`', re.MULTILINE r'(\s*):class:`(platypush\.backend\.(.+?))`', re.MULTILINE
) )
@override
@classmethod @classmethod
def parse(cls, docstring: str, *_, **__) -> str: def parse(cls, docstring: str, *_, **__) -> str:
while True: while True:

View file

@ -1,5 +1,4 @@
import re import re
from typing_extensions import override
from ._base import Parser from ._base import Parser
@ -14,7 +13,6 @@ class EventParser(Parser):
r'(\s*):class:`(platypush\.message\.event\.(.+?))`', re.MULTILINE r'(\s*):class:`(platypush\.message\.event\.(.+?))`', re.MULTILINE
) )
@override
@classmethod @classmethod
def parse(cls, docstring: str, *_, **__) -> str: def parse(cls, docstring: str, *_, **__) -> str:
while True: while True:

View file

@ -1,5 +1,4 @@
import re import re
from typing_extensions import override
from ._base import Parser from ._base import Parser
@ -16,7 +15,6 @@ class MethodParser(Parser):
_rel_method_regex = re.compile(r'(\s*):meth:`\.(.+?)`', re.MULTILINE) _rel_method_regex = re.compile(r'(\s*):meth:`\.(.+?)`', re.MULTILINE)
@override
@classmethod @classmethod
def parse(cls, docstring: str, obj_type: type) -> str: def parse(cls, docstring: str, obj_type: type) -> str:
while True: while True:

View file

@ -1,5 +1,4 @@
import re import re
from typing_extensions import override
from ._base import Parser from ._base import Parser
@ -14,7 +13,6 @@ class PluginParser(Parser):
r'(\s*):class:`(platypush\.plugins\.(.+?))`', re.MULTILINE r'(\s*):class:`(platypush\.plugins\.(.+?))`', re.MULTILINE
) )
@override
@classmethod @classmethod
def parse(cls, docstring: str, *_, **__) -> str: def parse(cls, docstring: str, *_, **__) -> str:
while True: while True:

View file

@ -1,5 +1,4 @@
import re import re
from typing_extensions import override
from ._base import Parser from ._base import Parser
@ -14,7 +13,6 @@ class ResponseParser(Parser):
r'(\s*):class:`(platypush\.message\.response\.(.+?))`', re.MULTILINE r'(\s*):class:`(platypush\.message\.response\.(.+?))`', re.MULTILINE
) )
@override
@classmethod @classmethod
def parse(cls, docstring: str, *_, **__) -> str: def parse(cls, docstring: str, *_, **__) -> str:
while True: while True:

View file

@ -5,7 +5,6 @@ import os
from random import randint from random import randint
import re import re
import textwrap import textwrap
from typing_extensions import override
from marshmallow import fields from marshmallow import fields
@ -59,7 +58,6 @@ class SchemaParser(Parser):
return str(field.__class__.__name__).lower() return str(field.__class__.__name__).lower()
@override
@classmethod @classmethod
def parse(cls, docstring: str, *_, **__) -> str: def parse(cls, docstring: str, *_, **__) -> str:
while True: while True:

View file

@ -1,7 +1,5 @@
from typing import Collection, List, Optional from typing import Collection, List, Optional
from typing_extensions import override
from linode_api4 import LinodeClient, Instance, objects from linode_api4 import LinodeClient, Instance, objects
from platypush.context import get_bus from platypush.context import get_bus
@ -88,7 +86,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
if not key.startswith('_') if not key.startswith('_')
} }
@override
def main(self): def main(self):
instances = [] instances = []
@ -133,7 +130,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
instances = new_status.values() instances = new_status.values()
self.wait_stop(self.poll_interval) self.wait_stop(self.poll_interval)
@override
def transform_entities( def transform_entities(
self, entities: Collection[LinodeInstance] self, entities: Collection[LinodeInstance]
) -> Collection[CloudInstance]: ) -> Collection[CloudInstance]:
@ -157,7 +153,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
) )
@action @action
@override
def status( def status(
self, self,
*_, *_,
@ -196,7 +191,6 @@ class LinodePlugin(RunnablePlugin, CloudInstanceEntityManager, EnumSwitchEntityM
return mapped_instances return mapped_instances
@override
@action @action
def reboot(self, instance: InstanceId, token: Optional[str] = None, **_): 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) node = self._get_instance(instance=instance, token=token)
assert node.reboot(), 'Reboot failed' assert node.reboot(), 'Reboot failed'
@override
@action @action
def boot(self, instance: InstanceId, token: Optional[str] = None, **_): 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) node = self._get_instance(instance=instance, token=token)
assert node.boot(), 'Boot failed' assert node.boot(), 'Boot failed'
@override
@action @action
def shutdown(self, instance: InstanceId, token: Optional[str] = None, **_): 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) node = self._get_instance(instance=instance, token=token)
assert node.shutdown(), 'Shutdown failed' assert node.shutdown(), 'Shutdown failed'
@override
@action @action
def set(self, entity: str, value: str, **kwargs): def set(self, entity: str, value: str, **kwargs):
""" """

View file

@ -4,7 +4,6 @@ import io
import json import json
import threading import threading
from typing import Any, Dict, Iterable, Optional, IO from typing import Any, Dict, Iterable, Optional, IO
from typing_extensions import override
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
@ -504,7 +503,6 @@ class MqttPlugin(RunnablePlugin):
""" """
return self.publish(*args, **kwargs) return self.publish(*args, **kwargs)
@override
def main(self): def main(self):
if self.run_topic: if self.run_topic:
self.logger.warning( self.logger.warning(
@ -519,7 +517,6 @@ class MqttPlugin(RunnablePlugin):
self.wait_stop() self.wait_stop()
@override
def stop(self): def stop(self):
""" """
Disconnect all the clients upon plugin stop. Disconnect all the clients upon plugin stop.

View file

@ -1,6 +1,5 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import Collection, Iterable, List, Mapping, Optional, Tuple, Type, Union 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.common.sensors import Numeric, SensorDataType
from platypush.context import get_bus 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} return {k: v for k, v in data.items() if k in self._enabled_sensors}
@override
@abstractmethod @abstractmethod
def transform_entities(self, entities: SensorDataType) -> Collection[Entity]: def transform_entities(self, entities: SensorDataType) -> Collection[Entity]:
raise NotImplementedError() raise NotImplementedError()
@override
def publish_entities( def publish_entities(
self, entities: SensorDataType, *args, **kwargs self, entities: SensorDataType, *args, **kwargs
) -> Collection[Entity]: ) -> Collection[Entity]:
@ -393,7 +390,6 @@ class SensorPlugin(RunnablePlugin, SensorEntityManager, ABC):
self.publish_entities(self._last_measurement) self.publish_entities(self._last_measurement)
return self._last_measurement return self._last_measurement
@override
def main(self): def main(self):
sleep_retry_secs = 1 # Exponential back-off sleep_retry_secs = 1 # Exponential back-off

View file

@ -1,6 +1,5 @@
from dataclasses import dataclass from dataclasses import dataclass
from typing import Dict, List, Type from typing import Dict, List, Type
from typing_extensions import override
from platypush.common.sensors import Numeric from platypush.common.sensors import Numeric
from platypush.entities.devices import Device from platypush.entities.devices import Device
@ -98,7 +97,6 @@ class SensorBme280Plugin(SensorPlugin):
self._device = BME280(i2c_dev=self._bus) self._device = BME280(i2c_dev=self._bus)
return self._device return self._device
@override
@action @action
def get_measurement(self, *_, **__): def get_measurement(self, *_, **__):
""" """
@ -123,7 +121,6 @@ class SensorBme280Plugin(SensorPlugin):
'altitude': device.get_altitude(), 'altitude': device.get_altitude(),
} }
@override
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
sensors = [] sensors = []
for sensor, value in entities.items(): for sensor, value in entities.items():

View file

@ -1,8 +1,7 @@
from typing import List, Optional, Dict from typing import List, Optional, Dict
from typing_extensions import override
from platypush.common.sensors import Numeric from platypush.common.sensors import Numeric
from platypush.entities.devices import Device from platypush.entities.devices import Device
from platypush.entities.humidity import HumiditySensor from platypush.entities.humidity import HumiditySensor
from platypush.entities.temperature import TemperatureSensor from platypush.entities.temperature import TemperatureSensor
from platypush.plugins import action from platypush.plugins import action
@ -101,7 +100,6 @@ class SensorDhtPlugin(SensorPlugin):
'temperature': temperature, 'temperature': temperature,
} }
@override
@action @action
def get_measurement(self, *_, **__) -> Dict[str, float]: def get_measurement(self, *_, **__) -> Dict[str, float]:
""" """
@ -119,7 +117,6 @@ class SensorDhtPlugin(SensorPlugin):
""" """
return self.read() # type: ignore return self.read() # type: ignore
@override
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
return [ return [
Device( Device(

View file

@ -1,7 +1,6 @@
from contextlib import contextmanager from contextlib import contextmanager
from threading import RLock from threading import RLock
from typing import List, Mapping from typing import List, Mapping
from typing_extensions import override
from platypush.entities.devices import Device from platypush.entities.devices import Device
from platypush.entities.distance import DistanceSensor from platypush.entities.distance import DistanceSensor
@ -65,7 +64,6 @@ class SensorDistanceVl53l1xPlugin(SensorPlugin):
self._device.close() self._device.close()
self._device = None self._device = None
@override
def get_measurement(self, *_, short=True, medium=True, long=True, **__): def get_measurement(self, *_, short=True, medium=True, long=True, **__):
""" """
:param short: Enable short range measurement (default: True) :param short: Enable short range measurement (default: True)
@ -109,7 +107,6 @@ class SensorDistanceVl53l1xPlugin(SensorPlugin):
return ret return ret
@override
def transform_entities(self, entities: Mapping[str, int]) -> List[Device]: def transform_entities(self, entities: Mapping[str, int]) -> List[Device]:
return [ return [
Device( Device(

View file

@ -1,6 +1,5 @@
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Type from typing import Any, Dict, List, Optional, Type
from typing_extensions import override
from platypush.common.sensors import Numeric from platypush.common.sensors import Numeric
from platypush.entities.acceleration import Accelerometer from platypush.entities.acceleration import Accelerometer
@ -99,7 +98,6 @@ class SensorEnvirophatPlugin(SensorPlugin):
""" """
@override
@action @action
def get_measurement(self, *_, qnh: float = 1020.0, **__): def get_measurement(self, *_, qnh: float = 1020.0, **__):
""" """
@ -156,7 +154,6 @@ class SensorEnvirophatPlugin(SensorPlugin):
return ret return ret
@override
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
return [ return [
Device( Device(

View file

@ -1,8 +1,6 @@
from collections.abc import Collection from collections.abc import Collection
import time import time
from typing import List, Optional, Union from typing import List, Optional, Union
from typing_extensions import override
import warnings import warnings
from platypush.context import get_bus 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 # s = vt where v = 1/2 * avg speed of sound in mm/s
return round(pulse_duration * 171500.0, 2) return round(pulse_duration * 171500.0, 2)
@override
@action @action
def get_measurement(self, *_, **__) -> Optional[float]: def get_measurement(self, *_, **__) -> Optional[float]:
""" """
@ -161,7 +158,6 @@ class SensorHcsr04Plugin(GpioPlugin, SensorPlugin):
self.cleanup() self.cleanup()
raise e raise e
@override
def transform_entities( def transform_entities(
self, entities: Union[Optional[float], Collection[Optional[float]]] self, entities: Union[Optional[float], Collection[Optional[float]]]
) -> List[DistanceSensor]: ) -> List[DistanceSensor]:

View file

@ -1,5 +1,4 @@
from typing import Any, Dict, List from typing import Any, Dict, List
from typing_extensions import override
from platypush.entities.acceleration import Accelerometer from platypush.entities.acceleration import Accelerometer
from platypush.plugins import action from platypush.plugins import action
@ -56,7 +55,6 @@ class SensorLis3dhPlugin(SensorPlugin):
self.sensor = LIS3DH() self.sensor = LIS3DH()
self.sensor.setRange(self.g) self.sensor.setRange(self.g)
@override
@action @action
def get_measurement(self, *_, **__): def get_measurement(self, *_, **__):
""" """
@ -74,7 +72,6 @@ class SensorLis3dhPlugin(SensorPlugin):
'value': {'x': values[0], 'y': values[1], 'z': values[2]}, 'value': {'x': values[0], 'y': values[1], 'z': values[2]},
} }
@override
def transform_entities(self, entities: Dict[str, Any]) -> List[Accelerometer]: def transform_entities(self, entities: Dict[str, Any]) -> List[Accelerometer]:
return Accelerometer( return Accelerometer(
id='lis3dh', id='lis3dh',

View file

@ -1,7 +1,5 @@
from typing import Dict, List from typing import Dict, List
from typing_extensions import override
from platypush.common.sensors import Numeric from platypush.common.sensors import Numeric
from platypush.entities.devices import Device from platypush.entities.devices import Device
from platypush.entities.distance import DistanceSensor from platypush.entities.distance import DistanceSensor
@ -35,7 +33,6 @@ class SensorLtr559Plugin(SensorPlugin):
super().__init__(**kwargs) super().__init__(**kwargs)
self.ltr = ltr559.LTR559() self.ltr = ltr559.LTR559()
@override
@action @action
def get_measurement(self, *_, **__): def get_measurement(self, *_, **__):
""" """
@ -55,7 +52,6 @@ class SensorLtr559Plugin(SensorPlugin):
'proximity': self.ltr.get_proximity(), 'proximity': self.ltr.get_proximity(),
} }
@override
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
sensors = [] sensors = []

View file

@ -1,6 +1,5 @@
import enum import enum
from typing import Dict, List from typing import Dict, List
from typing_extensions import override
from platypush.common.sensors import Numeric from platypush.common.sensors import Numeric
from platypush.entities.devices import Device from platypush.entities.devices import Device
@ -154,7 +153,6 @@ class SensorMcp3008Plugin(SensorPlugin):
def _convert_to_voltage(self, value): def _convert_to_voltage(self, value):
return (value * self.Vdd) / 1023.0 if value is not None else None return (value * self.Vdd) / 1023.0 if value is not None else None
@override
@action @action
def get_measurement(self): def get_measurement(self):
""" """
@ -197,7 +195,6 @@ class SensorMcp3008Plugin(SensorPlugin):
return values return values
@override
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
return [ return [
Device( Device(

View file

@ -2,7 +2,6 @@ import enum
import math import math
import time import time
from typing import Dict, List from typing import Dict, List
from typing_extensions import override
from platypush.common.sensors import Numeric from platypush.common.sensors import Numeric
from platypush.entities.devices import Device from platypush.entities.devices import Device
@ -114,7 +113,6 @@ class SensorPmw3901Plugin(SensorPlugin):
return self._sensor return self._sensor
@override
@action @action
def get_measurement(self, *_, **__): def get_measurement(self, *_, **__):
""" """
@ -156,7 +154,6 @@ class SensorPmw3901Plugin(SensorPlugin):
'motion_events_per_sec': self._events_per_sec.get(secs, 0), 'motion_events_per_sec': self._events_per_sec.get(secs, 0),
} }
@override
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
return [ return [
Device( Device(

View file

@ -3,7 +3,6 @@ from collections import namedtuple
import json import json
from typing import Dict, List, Optional, Union from typing import Dict, List, Optional, Union
import threading import threading
from typing_extensions import override
from serial import Serial from serial import Serial
@ -258,7 +257,6 @@ class SerialPlugin(SensorPlugin):
return _DeviceAndRate(device, baud_rate) return _DeviceAndRate(device, baud_rate)
@override
@action @action
def get_measurement( def get_measurement(
self, self,
@ -386,7 +384,6 @@ class SerialPlugin(SensorPlugin):
self.logger.info('Writing %d bytes to %s', len(data), device) self.logger.info('Writing %d bytes to %s', len(data), device)
ser.write(data) ser.write(data)
@override
def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]: def transform_entities(self, entities: Dict[str, Numeric]) -> List[Device]:
transformed_entities = [] transformed_entities = []
@ -415,7 +412,6 @@ class SerialPlugin(SensorPlugin):
) )
] ]
@override
def main(self): def main(self):
if not self._enable_polling: if not self._enable_polling:
# If the polling is disabled, we don't need to do anything here # If the polling is disabled, we don't need to do anything here
@ -424,7 +420,6 @@ class SerialPlugin(SensorPlugin):
super().main() super().main()
@override
def stop(self): def stop(self):
super().stop() super().stop()
self._close_serial() self._close_serial()

View file

@ -1,7 +1,6 @@
from dataclasses import asdict from dataclasses import asdict
import warnings import warnings
from typing import Iterable, List, Optional, Union from typing import Iterable, List, Optional, Union
from typing_extensions import override
from platypush.plugins import RunnablePlugin, action from platypush.plugins import RunnablePlugin, action
@ -471,7 +470,6 @@ class SoundPlugin(RunnablePlugin):
""" """
self._manager.set_volume(volume=volume, device=device, streams=streams) self._manager.set_volume(volume=volume, device=device, streams=streams)
@override
def main(self): def main(self):
try: try:
self.wait_stop() self.wait_stop()

View file

@ -1,5 +1,4 @@
from typing import Iterable from typing import Iterable
from typing_extensions import override
from ._base import AudioConverter from ._base import AudioConverter
@ -10,12 +9,10 @@ class RawInputAudioConverter(AudioConverter):
""" """
@property @property
@override
def _input_format_args(self) -> Iterable[str]: def _input_format_args(self) -> Iterable[str]:
return self._raw_ffmpeg_args return self._raw_ffmpeg_args
@property @property
@override
def _output_format_args(self) -> Iterable[str]: def _output_format_args(self) -> Iterable[str]:
return self._compressed_ffmpeg_args return self._compressed_ffmpeg_args

View file

@ -1,5 +1,4 @@
from typing import Iterable from typing import Iterable
from typing_extensions import override
from ._base import AudioConverter from ._base import AudioConverter
@ -10,12 +9,10 @@ class RawOutputAudioConverter(AudioConverter):
""" """
@property @property
@override
def _input_format_args(self) -> Iterable[str]: def _input_format_args(self) -> Iterable[str]:
return self._compressed_ffmpeg_args return self._compressed_ffmpeg_args
@property @property
@override
def _output_format_args(self) -> Iterable[str]: def _output_format_args(self) -> Iterable[str]:
return self._raw_ffmpeg_args return self._raw_ffmpeg_args
@ -30,7 +27,6 @@ class RawOutputAudioFromFileConverter(RawOutputAudioConverter):
self.infile = infile self.infile = infile
@property @property
@override
def _input_source_args(self) -> Iterable[str]: def _input_source_args(self) -> Iterable[str]:
return ('-i', self.infile) return ('-i', self.infile)

View file

@ -7,7 +7,6 @@ import queue
from threading import Event, RLock, Thread from threading import Event, RLock, Thread
import time import time
from typing import IO, Callable, Final, Generator, Optional, Tuple, Type, Union from typing import IO, Callable, Final, Generator, Optional, Tuple, Type, Union
from typing_extensions import override
import sounddevice as sd import sounddevice as sd
@ -326,7 +325,6 @@ class AudioThread(Thread, ABC):
# Continue only if the converter hasn't terminated # Continue only if the converter hasn't terminated
return not self._converter_terminated.is_set() return not self._converter_terminated.is_set()
@override
def run(self): def run(self):
""" """
Wrapper for the main loop that initializes the converter and the stream. Wrapper for the main loop that initializes the converter and the stream.

View file

@ -1,6 +1,5 @@
from abc import ABC from abc import ABC
from typing import IO, Iterable, List, Optional, Type, Union from typing import IO, Iterable, List, Optional, Type, Union
from typing_extensions import override
import numpy as np import numpy as np
import sounddevice as sd import sounddevice as sd
@ -55,25 +54,20 @@ class AudioPlayer(AudioThread, ABC):
raise AssertionError('Either infile or url must be specified') raise AssertionError('Either infile or url must be specified')
@property @property
@override
def direction(self) -> StreamType: def direction(self) -> StreamType:
return StreamType.OUTPUT return StreamType.OUTPUT
@override
def _on_converter_timeout(self, *_, **__) -> bool: def _on_converter_timeout(self, *_, **__) -> bool:
return False # break return False # break
@property @property
@override
def _stream_type(self) -> Type[sd.RawOutputStream]: def _stream_type(self) -> Type[sd.RawOutputStream]:
return sd.RawOutputStream return sd.RawOutputStream
@property @property
@override
def _audio_converter_type(self) -> Type[RawOutputAudioConverter]: def _audio_converter_type(self) -> Type[RawOutputAudioConverter]:
return RawOutputAudioConverter return RawOutputAudioConverter
@override
def _on_audio_converted(self, data: bytes, out_f: Optional[IO] = None): def _on_audio_converted(self, data: bytes, out_f: Optional[IO] = None):
if self.audio_stream: if self.audio_stream:
self.audio_stream.write( self.audio_stream.write(
@ -87,22 +81,18 @@ class AudioPlayer(AudioThread, ABC):
super()._on_audio_converted(data, out_f) super()._on_audio_converted(data, out_f)
@property @property
@override
def _started_event_type(self) -> Type[SoundPlaybackStartedEvent]: def _started_event_type(self) -> Type[SoundPlaybackStartedEvent]:
return SoundPlaybackStartedEvent return SoundPlaybackStartedEvent
@property @property
@override
def _stopped_event_type(self) -> Type[SoundPlaybackStoppedEvent]: def _stopped_event_type(self) -> Type[SoundPlaybackStoppedEvent]:
return SoundPlaybackStoppedEvent return SoundPlaybackStoppedEvent
@property @property
@override
def _paused_event_type(self) -> Type[SoundPlaybackPausedEvent]: def _paused_event_type(self) -> Type[SoundPlaybackPausedEvent]:
return SoundPlaybackPausedEvent return SoundPlaybackPausedEvent
@property @property
@override
def _resumed_event_type(self) -> Type[SoundPlaybackResumedEvent]: def _resumed_event_type(self) -> Type[SoundPlaybackResumedEvent]:
return SoundPlaybackResumedEvent return SoundPlaybackResumedEvent

View file

@ -1,5 +1,4 @@
from typing import Optional, Type from typing import Optional, Type
from typing_extensions import override
from platypush.message.event.sound import SoundEvent from platypush.message.event.sound import SoundEvent
@ -14,12 +13,10 @@ class AudioResourcePlayer(AudioPlayer):
""" """
@property @property
@override
def _audio_converter_type(self) -> Type[RawOutputAudioFromFileConverter]: def _audio_converter_type(self) -> Type[RawOutputAudioFromFileConverter]:
return RawOutputAudioFromFileConverter return RawOutputAudioFromFileConverter
@property @property
@override
def _converter_args(self) -> dict: def _converter_args(self) -> dict:
return { return {
'infile': self.infile, 'infile': self.infile,
@ -27,11 +24,9 @@ class AudioResourcePlayer(AudioPlayer):
} }
@property @property
@override
def _converter_stdin(self) -> Optional[int]: def _converter_stdin(self) -> Optional[int]:
return None return None
@override
def _notify(self, event_type: Type[SoundEvent], **kwargs): def _notify(self, event_type: Type[SoundEvent], **kwargs):
return super()._notify(event_type, resource=self.infile, **kwargs) return super()._notify(event_type, resource=self.infile, **kwargs)

View file

@ -1,7 +1,6 @@
import json import json
import logging import logging
from typing import List, Tuple, Union from typing import List, Tuple, Union
from typing_extensions import override
import numpy as np import numpy as np
from numpy.typing import DTypeLike, NDArray from numpy.typing import DTypeLike, NDArray
@ -57,7 +56,6 @@ class Mix(SoundBase):
for sound_index in sound_indices[::-1]: for sound_index in sound_indices[::-1]:
self._sounds.pop(sound_index) self._sounds.pop(sound_index)
@override
def get_wave( def get_wave(
self, self,
sample_rate: float, sample_rate: float,

View file

@ -2,7 +2,6 @@ from contextlib import contextmanager
from queue import Queue from queue import Queue
from threading import Event from threading import Event
from typing import Any, Generator, Iterable, Optional, Type from typing import Any, Generator, Iterable, Optional, Type
from typing_extensions import override
import numpy as np import numpy as np
import sounddevice as sd import sounddevice as sd
@ -42,12 +41,10 @@ class AudioSynthPlayer(AudioPlayer):
) )
@property @property
@override
def _stream_type(self) -> Type[sd.OutputStream]: def _stream_type(self) -> Type[sd.OutputStream]:
return sd.OutputStream return sd.OutputStream
@property @property
@override
def _audio_converter_type(self) -> None: def _audio_converter_type(self) -> None:
pass pass
@ -61,7 +58,6 @@ class AudioSynthPlayer(AudioPlayer):
self.mix.volume = __value self.mix.volume = __value
return super().__setattr__(__name, __value) return super().__setattr__(__name, __value)
@override
def _on_converter_timeout(self, *_, **__) -> bool: def _on_converter_timeout(self, *_, **__) -> bool:
""" """
Don't break the audio stream if the output converter failed Don't break the audio stream if the output converter failed
@ -69,7 +65,6 @@ class AudioSynthPlayer(AudioPlayer):
return True return True
@property @property
@override
def _stream_args(self) -> dict: def _stream_args(self) -> dict:
""" """
Register an :class:`.AudioOutputCallback` to fill up the audio buffers. 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 return self.blocksize * (self.queue_size or 5) / self.sample_rate
@override
@contextmanager @contextmanager
def _audio_generator(self) -> Generator[AudioGenerator, None, None]: def _audio_generator(self) -> Generator[AudioGenerator, None, None]:
stop_generator = Event() stop_generator = Event()

View file

@ -1,7 +1,6 @@
from enum import Enum from enum import Enum
import json import json
from typing import Final, Optional, Tuple, Union from typing import Final, Optional, Tuple, Union
from typing_extensions import override
import numpy as np import numpy as np
from numpy.typing import NDArray from numpy.typing import NDArray
@ -144,7 +143,6 @@ class Sound(SoundBase):
return wave return wave
@override
def get_wave( def get_wave(
self, self,
sample_rate: float, sample_rate: float,

View file

@ -1,5 +1,4 @@
from typing import Type from typing import Type
from typing_extensions import override
import sounddevice as sd import sounddevice as sd
@ -27,11 +26,9 @@ class AudioRecorder(AudioThread):
self.output_format = output_format self.output_format = output_format
@property @property
@override
def direction(self) -> StreamType: def direction(self) -> StreamType:
return StreamType.INPUT return StreamType.INPUT
@override
def _audio_callback(self): def _audio_callback(self):
# _ = frames # _ = frames
# __ = time # __ = time
@ -62,32 +59,26 @@ class AudioRecorder(AudioThread):
return callback return callback
@property @property
@override
def _audio_converter_type(self) -> Type[RawInputAudioConverter]: def _audio_converter_type(self) -> Type[RawInputAudioConverter]:
return RawInputAudioConverter return RawInputAudioConverter
@property @property
@override
def _started_event_type(self) -> Type[SoundRecordingStartedEvent]: def _started_event_type(self) -> Type[SoundRecordingStartedEvent]:
return SoundRecordingStartedEvent return SoundRecordingStartedEvent
@property @property
@override
def _stopped_event_type(self) -> Type[SoundRecordingStoppedEvent]: def _stopped_event_type(self) -> Type[SoundRecordingStoppedEvent]:
return SoundRecordingStoppedEvent return SoundRecordingStoppedEvent
@property @property
@override
def _paused_event_type(self) -> Type[SoundRecordingPausedEvent]: def _paused_event_type(self) -> Type[SoundRecordingPausedEvent]:
return SoundRecordingPausedEvent return SoundRecordingPausedEvent
@property @property
@override
def _resumed_event_type(self) -> Type[SoundRecordingResumedEvent]: def _resumed_event_type(self) -> Type[SoundRecordingResumedEvent]:
return SoundRecordingResumedEvent return SoundRecordingResumedEvent
@property @property
@override
def _converter_args(self) -> dict: def _converter_args(self) -> dict:
return { return {
'format': self.output_format, 'format': self.output_format,
@ -95,7 +86,6 @@ class AudioRecorder(AudioThread):
} }
@property @property
@override
def _stream_args(self) -> dict: def _stream_args(self) -> dict:
return { return {
'callback': self._audio_callback(), 'callback': self._audio_callback(),

View file

@ -1,7 +1,5 @@
import os import os
from typing import Tuple, Union, List, Optional from typing import Tuple, Union, List, Optional
from typing_extensions import override
import psutil import psutil
@ -506,7 +504,6 @@ class SystemPlugin(SensorPlugin, EntityManager):
""" """
self._get_process(pid).wait(timeout) self._get_process(pid).wait(timeout)
@override
@action @action
def get_measurement(self, *_, **__): def get_measurement(self, *_, **__):
""" """
@ -532,7 +529,6 @@ class SystemPlugin(SensorPlugin, EntityManager):
} }
) )
@override
def transform_entities(self, entities: dict) -> List[Entity]: def transform_entities(self, entities: dict) -> List[Entity]:
cpu = entities['cpu'].copy() cpu = entities['cpu'].copy()
battery = entities['battery'] battery = entities['battery']

View file

@ -1,7 +1,6 @@
from functools import wraps from functools import wraps
from threading import Event, RLock from threading import Event, RLock
from typing import Any, Callable, Collection, Dict, Iterable, Optional, Union 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 import EntityManager, get_entities_engine
from platypush.entities.variables import Variable from platypush.entities.variables import Variable
@ -170,7 +169,6 @@ class VariablePlugin(Plugin, EntityManager):
return self._redis.expire(name, expire) return self._redis.expire(name, expire)
@override
def transform_entities( def transform_entities(
self, entities: Union[dict, Iterable] self, entities: Union[dict, Iterable]
) -> Collection[Variable]: ) -> Collection[Variable]:
@ -193,7 +191,6 @@ class VariablePlugin(Plugin, EntityManager):
] ]
) )
@override
@action @action
@ensure_initialized @ensure_initialized
def status(self, *_, **__): def status(self, *_, **__):

View file

@ -1,6 +1,5 @@
import os import os
from typing import Iterable, Optional, Type, Union from typing import Iterable, Optional, Type, Union
from typing_extensions import override
import aioxmpp import aioxmpp
import aioxmpp.im import aioxmpp.im
@ -177,11 +176,9 @@ class XmppPlugin(AsyncRunnablePlugin, XmppBasePlugin):
return self._handlers[hndl_type] return self._handlers[hndl_type]
@override
def should_stop(self) -> bool: def should_stop(self) -> bool:
return super().should_stop() or self._state.should_stop.is_set() return super().should_stop() or self._state.should_stop.is_set()
@override
def stop(self): def stop(self):
self._state.should_stop.set() self._state.should_stop.set()
self._stop_state_serializer() self._stop_state_serializer()
@ -199,7 +196,6 @@ class XmppPlugin(AsyncRunnablePlugin, XmppBasePlugin):
self._client.stop() self._client.stop()
self._client = None self._client = None
@override
async def listen(self): async def listen(self):
self._client = aioxmpp.PresenceManagedClient(self._jid, self._security) self._client = aioxmpp.PresenceManagedClient(self._jid, self._security)

View file

@ -1,6 +1,5 @@
from collections import defaultdict from collections import defaultdict
from typing import Type from typing import Type
from typing_extensions import override
from .._base import XmppBasePlugin from .._base import XmppBasePlugin
from ._base import XmppBaseHandler from ._base import XmppBaseHandler
@ -15,6 +14,5 @@ class XmppHandlersRegistry(defaultdict):
super().__init__() super().__init__()
self._plugin = plugin self._plugin = plugin
@override
def __missing__(self, hndl_type: Type[XmppBaseHandler]) -> XmppBaseHandler: def __missing__(self, hndl_type: Type[XmppBaseHandler]) -> XmppBaseHandler:
return self._plugin.register_handler(hndl_type) return self._plugin.register_handler(hndl_type)

View file

@ -1,6 +1,5 @@
import asyncio import asyncio
from typing import Iterable, Optional, Union from typing import Iterable, Optional, Union
from typing_extensions import override
import aioxmpp import aioxmpp
import aioxmpp.im import aioxmpp.im
@ -49,7 +48,6 @@ class XmppRoomHandler(XmppBaseHandler):
] ]
) )
@override
def restore_state(self): def restore_state(self):
self._async_run(self._restore_state, wait_result=False) self._async_run(self._restore_state, wait_result=False)

View file

@ -1,5 +1,5 @@
from typing import Union from typing import Union
from typing_extensions import override
import aioxmpp import aioxmpp
import aioxmpp.roster.xso 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_entry_removed.connect(self._on_roster_entry_removed) # type: ignore
self.roster.on_subscribe.connect(self._on_roster_subscribe) # type: ignore self.roster.on_subscribe.connect(self._on_roster_subscribe) # type: ignore
@override
def restore_state(self): def restore_state(self):
if self._loaded_state.users: if self._loaded_state.users:
for user_id in self._loaded_state.users: for user_id in self._loaded_state.users:

View file

@ -1,5 +1,4 @@
from abc import ABC from abc import ABC
from typing_extensions import override
from ._events import XmppEventMixin from ._events import XmppEventMixin
from ._state import XmppStateMixin from ._state import XmppStateMixin
@ -12,7 +11,6 @@ class XmppEventStateMixin(XmppEventMixin, XmppStateMixin, ABC):
features to handle events. features to handle events.
""" """
@override
def _post_event(self, *args, **kwargs): def _post_event(self, *args, **kwargs):
if self._state_serializer: if self._state_serializer:
self._state_serializer.enqueue(self._state) self._state_serializer.enqueue(self._state)

View file

@ -15,7 +15,6 @@ from typing import (
Type, Type,
Union, Union,
) )
from typing_extensions import override
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
@ -313,7 +312,6 @@ class ZigbeeMqttPlugin(
if option.get('property') if option.get('property')
} }
@override
def transform_entities(self, entities: Collection[dict]) -> List[Entity]: def transform_entities(self, entities: Collection[dict]) -> List[Entity]:
compatible_entities = [] compatible_entities = []
for dev in entities: for dev in entities:
@ -1222,7 +1220,6 @@ class ZigbeeMqttPlugin(
self.device_set(dev, property, data, **kwargs) self.device_set(dev, property, data, **kwargs)
@override
@action @action
def set(self, entity: str, value: Any, attribute: Optional[str] = None, **kwargs): def set(self, entity: str, value: Any, attribute: Optional[str] = None, **kwargs):
return self.set_value(entity, data=value, property=attribute, **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) self.device_set(self._preferred_name(dev), values=data)
@override
def on_mqtt_message(self): def on_mqtt_message(self):
""" """
Overrides :meth:`platypush.plugins.mqtt.MqttPlugin.on_mqtt_message` to Overrides :meth:`platypush.plugins.mqtt.MqttPlugin.on_mqtt_message` to

View file

@ -21,8 +21,6 @@ from typing import (
) )
from urllib.parse import parse_qs, urlparse from urllib.parse import parse_qs, urlparse
from typing_extensions import override
from platypush.entities import ( from platypush.entities import (
DimmerEntityManager, DimmerEntityManager,
EnumSwitchEntityManager, EnumSwitchEntityManager,
@ -958,7 +956,6 @@ class ZwaveMqttPlugin(
assert group_id in groups, f'No such group_id: {group_id}' assert group_id in groups, f'No such group_id: {group_id}'
return groups[group_id] return groups[group_id]
@override
def on_mqtt_message(self): def on_mqtt_message(self):
def handler(_, __, msg): def handler(_, __, msg):
if not msg.topic.startswith(self.events_topic): if not msg.topic.startswith(self.events_topic):
@ -2189,7 +2186,6 @@ class ZwaveMqttPlugin(
'id': value['value_id'], 'id': value['value_id'],
} }
@override
def main(self): def main(self):
self.get_nodes() self.get_nodes()
super().main() super().main()

View file

@ -3,7 +3,6 @@ import logging
from multiprocessing import Event, Process, RLock from multiprocessing import Event, Process, RLock
from os import getpid from os import getpid
from typing import Optional from typing import Optional
from typing_extensions import override
class ControllableProcess(Process, ABC): class ControllableProcess(Process, ABC):
@ -121,7 +120,6 @@ class ControllableProcess(Process, ABC):
self._should_restart = False self._should_restart = False
return self.main() return self.main()
@override
def run(self) -> None: def run(self) -> None:
""" """
Executes the process. Executes the process.

View file

@ -3,7 +3,6 @@ import os
import signal import signal
import subprocess import subprocess
import sys import sys
from typing_extensions import override
from platypush.process import ControllableProcess from platypush.process import ControllableProcess
@ -27,7 +26,6 @@ class ApplicationProcess(ControllableProcess):
def __exit__(self, *_, **__): def __exit__(self, *_, **__):
self.stop() self.stop()
@override
def main(self): def main(self):
self.logger.info('Starting application...') self.logger.info('Starting application...')
@ -42,7 +40,6 @@ class ApplicationProcess(ControllableProcess):
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
@override
def on_stop(self): def on_stop(self):
try: try:
with open(self.pidfile, 'r') as f: with open(self.pidfile, 'r') as f:

View file

@ -25,7 +25,6 @@ from typing import (
Type, Type,
Union, Union,
) )
from typing_extensions import override
import yaml import yaml
@ -551,7 +550,6 @@ class PluginManifest(Manifest):
""" """
@property @property
@override
def manifest_type(self) -> ManifestType: def manifest_type(self) -> ManifestType:
return ManifestType.PLUGIN return ManifestType.PLUGIN
@ -563,7 +561,6 @@ class BackendManifest(Manifest):
""" """
@property @property
@override
def manifest_type(self) -> ManifestType: def manifest_type(self) -> ManifestType:
return ManifestType.BACKEND return ManifestType.BACKEND