Skip to content

Commit 3284d26

Browse files
committed
Fix pylint
1 parent 167f17b commit 3284d26

File tree

4 files changed

+13
-29
lines changed

4 files changed

+13
-29
lines changed

libpurecool/dyson_360_eye.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import paho.mqtt.client as mqtt
99

10-
from .dyson_device import DysonDevice, NetworkDevice, DEFAULT_PORT
10+
from .dyson_device import DysonDevice
1111
from .utils import printable_fields
1212
from .const import PowerMode, Dyson360EyeMode, Dyson360EyeCommand
1313

@@ -31,18 +31,6 @@ def _device_serial_from_name(name):
3131
"""Get device serial from mDNS name."""
3232
return (name.split(".")[0]).split("-", 1)[1]
3333

34-
def connect(self, device_ip, device_port=DEFAULT_PORT):
35-
"""Try to connect to device.
36-
37-
:param device_ip: Device IP address
38-
:param device_port: Device Port (default: 1883)
39-
:return: True if connected, else False
40-
"""
41-
self._network_device = NetworkDevice(self._name, device_ip,
42-
device_port)
43-
44-
return self._mqtt_connect()
45-
4634
def _mqtt_connect(self):
4735
"""Connect to the MQTT broker."""
4836
self._mqtt = mqtt.Client(userdata=self, protocol=3)

libpurecool/dyson_device.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,17 @@ def connection_callback(self, connected):
146146
"""Set function called when device is connected."""
147147
self._connection_queue.put_nowait(connected)
148148

149-
@abc.abstractmethod
150149
def connect(self, device_ip, device_port=DEFAULT_PORT):
151150
"""Connect to the device using ip address.
152151
153152
:param device_ip: Device IP address
154153
:param device_port: Device Port (default: 1883)
155154
:return: True if connected, else False
156155
"""
157-
return
156+
self._network_device = NetworkDevice(self._name, device_ip,
157+
device_port)
158+
159+
return self._mqtt_connect()
158160

159161
def _auto_connect(self, type_, timeout=5, retry=15):
160162
"""Try to connect to device using mDNS."""
@@ -179,6 +181,11 @@ def _auto_connect(self, type_, timeout=5, retry=15):
179181
return False
180182
return self._mqtt_connect()
181183

184+
@abc.abstractmethod
185+
def _mqtt_connect(self):
186+
"""Connect to the MQTT broker."""
187+
return
188+
182189
@staticmethod
183190
@abc.abstractmethod
184191
def _device_serial_from_name(name):

libpurecool/dyson_pure_cool_link.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from .dyson_pure_state_v2 import \
1515
DysonEnvironmentalSensorV2State, DysonPureCoolV2State, \
1616
DysonPureHotCoolV2State
17-
from .dyson_device import DysonDevice, NetworkDevice, DEFAULT_PORT
17+
from .dyson_device import DysonDevice
1818
from .utils import printable_fields, support_heating, is_pure_cool_v2, \
1919
support_heating_v2
2020
from .dyson_pure_state import DysonPureHotCoolState, DysonPureCoolState, \
@@ -90,18 +90,6 @@ def _device_serial_from_name(name):
9090
"""Get device serial from mDNS name."""
9191
return (name.split(".")[0]).split("_")[1]
9292

93-
def connect(self, device_ip, device_port=DEFAULT_PORT):
94-
"""Connect to the device using ip address.
95-
96-
:param device_ip: Device IP address
97-
:param device_port: Device Port (default: 1883)
98-
:return: True if connected, else False
99-
"""
100-
self._network_device = NetworkDevice(self._name, device_ip,
101-
device_port)
102-
103-
return self._mqtt_connect()
104-
10593
def _mqtt_connect(self):
10694
"""Connect to the MQTT broker."""
10795
self._mqtt = mqtt.Client(userdata=self)

tests/test_360_eye.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
from unittest.mock import Mock
55
import json
66

7-
from libpurecool.dyson_360_eye import Dyson360Eye, NetworkDevice, \
7+
from libpurecool.dyson_360_eye import Dyson360Eye, \
88
Dyson360EyeState, Dyson360EyeMapGlobal, Dyson360EyeMapData, \
99
Dyson360EyeMapGrid, Dyson360EyeTelemetryData, Dyson360Goodbye
10+
from libpurecool.dyson_device import NetworkDevice
1011
from libpurecool.const import PowerMode, Dyson360EyeMode
1112

1213

0 commit comments

Comments
 (0)