refactor: Update type annotations
Signed-off-by: Sven Sager <s.sager@kunbus.com>
This commit is contained in:
@@ -3,9 +3,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
"""D-Bus interfaces for IOs."""
|
"""D-Bus interfaces for IOs."""
|
||||||
|
|
||||||
from typing import Union
|
from pydbus.bus import Bus
|
||||||
|
|
||||||
from dbus import SystemBus, SessionBus
|
|
||||||
from pydbus.generic import signal
|
from pydbus.generic import signal
|
||||||
from revpimodio2.device import Device
|
from revpimodio2.device import Device
|
||||||
|
|
||||||
@@ -50,7 +48,7 @@ class InterfaceDevice:
|
|||||||
interface_name = "com.revolutionpi.ios1.Device"
|
interface_name = "com.revolutionpi.ios1.Device"
|
||||||
PropertiesChanged = signal()
|
PropertiesChanged = signal()
|
||||||
|
|
||||||
def __init__(self, dbus: Union[SystemBus, SessionBus], device: Device):
|
def __init__(self, dbus: Bus, device: Device):
|
||||||
self.dbus = dbus
|
self.dbus = dbus
|
||||||
self.device = device
|
self.device = device
|
||||||
self.object_path = get_device_object_path(device)
|
self.object_path = get_device_object_path(device)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
from typing import Union, List
|
from typing import Union, List
|
||||||
|
|
||||||
from dbus import SystemBus, SessionBus
|
from pydbus import Variant
|
||||||
from gi.overrides.GLib import Variant
|
from pydbus.bus import Bus
|
||||||
from pydbus.generic import signal
|
from pydbus.generic import signal
|
||||||
from revpimodio2 import RevPiModIO, Cycletools, INP, OUT
|
from revpimodio2 import RevPiModIO, Cycletools, INP, OUT
|
||||||
from revpimodio2.io import IOBase
|
from revpimodio2.io import IOBase
|
||||||
@@ -58,7 +58,7 @@ class InterfaceInput:
|
|||||||
interface_name = "com.revolutionpi.ios1.Input"
|
interface_name = "com.revolutionpi.ios1.Input"
|
||||||
PropertiesChanged = signal()
|
PropertiesChanged = signal()
|
||||||
|
|
||||||
def __init__(self, dbus: Union[SystemBus, SessionBus], io: IOBase):
|
def __init__(self, dbus: Bus, io: IOBase):
|
||||||
self._raw = False
|
self._raw = False
|
||||||
self.dbus = dbus
|
self.dbus = dbus
|
||||||
self.io = io
|
self.io = io
|
||||||
|
|||||||
@@ -4,9 +4,8 @@
|
|||||||
"""Helper for dbus."""
|
"""Helper for dbus."""
|
||||||
|
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from typing import Union
|
|
||||||
|
|
||||||
from pydbus import SessionBus, SystemBus
|
from pydbus.bus import Bus
|
||||||
|
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
|
|
||||||
@@ -16,7 +15,7 @@ REVPI_DBUS_BASE_PATH = "/com/revolutionpi/middleware1"
|
|||||||
|
|
||||||
class DbusInterface:
|
class DbusInterface:
|
||||||
|
|
||||||
def __init__(self, bus: Union[SessionBus, SystemBus]):
|
def __init__(self, bus: Bus):
|
||||||
self.bus = bus
|
self.bus = bus
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
|
|
||||||
|
from pydbus.bus import Bus
|
||||||
from pydbus.generic import signal
|
from pydbus.generic import signal
|
||||||
|
|
||||||
from .process_image_helper import PiControlIoctl, ResetDriverWatchdog
|
from .process_image_helper import PiControlIoctl, ResetDriverWatchdog
|
||||||
@@ -27,7 +28,7 @@ class InterfacePiControl(DbusInterface):
|
|||||||
|
|
||||||
NotifyDriverReset = signal()
|
NotifyDriverReset = signal()
|
||||||
|
|
||||||
def __init__(self, bus, picontrol_device: str, config_rsc: str):
|
def __init__(self, bus: Bus, picontrol_device: str, config_rsc: str):
|
||||||
super().__init__(bus)
|
super().__init__(bus)
|
||||||
|
|
||||||
self.picontrol_device = picontrol_device
|
self.picontrol_device = picontrol_device
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
from pydbus.bus import Bus
|
||||||
from pydbus.generic import signal
|
from pydbus.generic import signal
|
||||||
|
|
||||||
from ..dbus_helper import DbusInterface
|
from ..dbus_helper import DbusInterface
|
||||||
@@ -48,7 +49,7 @@ class InterfaceSoftwareServices(DbusInterface):
|
|||||||
AvailabilityChanged = signal()
|
AvailabilityChanged = signal()
|
||||||
StatusChanged = signal()
|
StatusChanged = signal()
|
||||||
|
|
||||||
def __init__(self, bus):
|
def __init__(self, bus: Bus):
|
||||||
super().__init__(bus)
|
super().__init__(bus)
|
||||||
|
|
||||||
self.mrk_available = {}
|
self.mrk_available = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user