Skip to content

Commit e64a2f5

Browse files
committed
Reset codacy part
1 parent 8abdc53 commit e64a2f5

File tree

4 files changed

+36
-32
lines changed

4 files changed

+36
-32
lines changed

.github/workflows/verify.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ jobs:
227227
coverage xml
228228
- name: Upload coverage to Codecov
229229
uses: codecov/codecov-action@v1
230+
- name: Run codacy-coverage-reporter
231+
uses: codacy/codacy-coverage-reporter-action@master
232+
with:
233+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
234+
coverage-reports: coverage.xml
230235

231236
test-publishing:
232237
name: Build and publish Python 🐍 distributions 📦 to TestPyPI

plugwise/connections/serial.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
import serial
99

1010
from plugwise.connections.connection import StickConnection
11-
from plugwise.constants import BAUD_RATE, BYTE_SIZE, PARITY, SLEEP_TIME, STOPBITS
11+
from plugwise.constants import BAUD_RATE, BYTE_SIZE, STOPBITS
1212
from plugwise.exceptions import PortError
13-
from plugwise.message import PlugwiseMessage
13+
14+
# from plugwise.message import PlugwiseMessage
1415

1516
_LOGGER = logging.getLogger(__name__)
1617

plugwise/node.py

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434

3535
class PlugwiseNode:
36-
""" Base class for a Plugwise node """
36+
"""Base class for a Plugwise node."""
3737

3838
def __init__(self, mac, address, stick):
3939
mac = mac.upper()
@@ -65,7 +65,7 @@ def __init__(self, mac, address, stick):
6565
self._features = None
6666

6767
def get_node_type(self) -> str:
68-
"""Return hardware model"""
68+
"""Return hardware model."""
6969
if self._hardware_version:
7070
hw_model = HW_MODELS.get(self._hardware_version[4:10], None)
7171
if hw_model:
@@ -83,27 +83,27 @@ def get_node_type(self) -> str:
8383
return "Unknown"
8484

8585
def is_sed(self) -> bool:
86-
""" Return True if node SED (battery powered)"""
86+
"""Return True if node SED (battery powered)."""
8787
return False
8888

8989
def get_categories(self) -> tuple:
90-
""" Return Home Assistant categories supported by plugwise node """
90+
"""Return Home Assistant categories supported by plugwise node."""
9191
return self.categories
9292

9393
def get_sensors(self) -> tuple:
94-
""" Return sensors supported by plugwise node """
94+
"""Return sensors supported by plugwise node."""
9595
return self.sensors
9696

9797
def get_switches(self) -> tuple:
98-
""" Return switches supported by plugwise node """
98+
"""Return switches supported by plugwise node."""
9999
return self.switches
100100

101101
def get_available(self) -> bool:
102-
""" Return current network state of plugwise node """
102+
"""Return current network state of plugwise node."""
103103
return self._available
104104

105105
def set_available(self, state, request_info=False):
106-
""" Set current network state of plugwise node """
106+
"""Set current network state of plugwise node."""
107107
if state is True:
108108
if self._available is False:
109109
self._available = True
@@ -124,72 +124,70 @@ def set_available(self, state, request_info=False):
124124
self.do_callback(SENSOR_AVAILABLE["id"])
125125

126126
def get_mac(self) -> str:
127-
"""Return mac address"""
127+
"""Return mac address."""
128128
return self.mac.decode(UTF8_DECODE)
129129

130130
def get_name(self) -> str:
131-
"""Return unique name"""
131+
"""Return unique name."""
132132
return self.get_node_type() + " (" + str(self._address) + ")"
133133

134134
def get_hardware_version(self) -> str:
135-
"""Return hardware version"""
135+
"""Return hardware version."""
136136
if self._hardware_version is not None:
137137
return self._hardware_version
138138
return "Unknown"
139139

140140
def get_firmware_version(self) -> str:
141-
"""Return firmware version"""
141+
"""Return firmware version."""
142142
if self._firmware_version is not None:
143143
return str(self._firmware_version)
144144
return "Unknown"
145145

146146
def get_last_update(self) -> datetime:
147-
"""Return version"""
147+
"""Return version."""
148148
return self.last_update
149149

150150
def get_in_RSSI(self) -> int:
151-
"""Return inbound RSSI level"""
151+
"""Return inbound RSSI level."""
152152
if self.in_RSSI is not None:
153153
return self.in_RSSI
154154
return 0
155155

156156
def get_out_RSSI(self) -> int:
157-
"""Return outbound RSSI level"""
157+
"""Return outbound RSSI level."""
158158
if self.out_RSSI is not None:
159159
return self.out_RSSI
160160
return 0
161161

162162
def get_ping(self) -> int:
163-
"""Return ping roundtrip"""
163+
"""Return ping roundtrip."""
164164
if self.ping_ms is not None:
165165
return self.ping_ms
166166
return 0
167167

168168
def _request_info(self, callback=None):
169-
""" Request info from node"""
169+
"""Request info from node"""
170170
self.stick.send(
171171
NodeInfoRequest(self.mac),
172172
callback,
173173
)
174174

175175
def _request_features(self, callback=None):
176-
""" Request supported features for this node"""
176+
"""Request supported features for this node."""
177177
self.stick.send(
178178
NodeFeaturesRequest(self.mac),
179179
callback,
180180
)
181181

182182
def ping(self, callback=None):
183-
""" Ping node"""
183+
"""Ping node."""
184184
self.stick.send(
185185
NodePingRequest(self.mac),
186186
callback,
187187
)
188188

189189
def on_message(self, message):
190-
"""
191-
Process received message
192-
"""
190+
"""Process received message."""
193191
assert isinstance(message, PlugwiseMessage)
194192
if message.mac == self.mac:
195193
if message.timestamp is not None:
@@ -220,7 +218,7 @@ def _on_message(self, message):
220218
pass
221219

222220
def subscribe_callback(self, callback, sensor) -> bool:
223-
""" Subscribe callback to execute when state change happens """
221+
"""Subscribe callback to execute when state change happens."""
224222
if sensor in self.sensors:
225223
if sensor not in self._callbacks:
226224
self._callbacks[sensor] = []
@@ -229,12 +227,12 @@ def subscribe_callback(self, callback, sensor) -> bool:
229227
return False
230228

231229
def unsubscribe_callback(self, callback, sensor):
232-
""" Unsubscribe callback to execute when state change happens """
230+
"""Unsubscribe callback to execute when state change happens."""
233231
if sensor in self._callbacks:
234232
self._callbacks[sensor].remove(callback)
235233

236234
def do_callback(self, sensor):
237-
""" Execute callbacks registered for specified callback type """
235+
"""Execute callbacks registered for specified callback type."""
238236
if sensor in self._callbacks:
239237
for callback in self._callbacks[sensor]:
240238
try:
@@ -246,7 +244,7 @@ def do_callback(self, sensor):
246244
)
247245

248246
def _process_ping_response(self, message):
249-
""" Process ping response message"""
247+
"""Process ping response message."""
250248
self.set_available(True, True)
251249
if self.in_RSSI != message.in_RSSI.value:
252250
self.in_RSSI = message.in_RSSI.value
@@ -259,7 +257,7 @@ def _process_ping_response(self, message):
259257
self.do_callback(SENSOR_PING["id"])
260258

261259
def _process_info_response(self, message):
262-
""" Process info response message"""
260+
"""Process info response message."""
263261
_LOGGER.debug("Response info message for node %s", self.get_mac())
264262
self.set_available(True)
265263
if message.relay_state.serialize() == b"01":
@@ -284,7 +282,7 @@ def _process_info_response(self, message):
284282
_LOGGER.debug("Firmware version = %s", str(self._firmware_version))
285283

286284
def _process_features_response(self, message):
287-
""" Process features message """
285+
"""Process features message."""
288286
_LOGGER.info(
289287
"Node %s supports features %s", self.get_mac(), str(message.features.value)
290288
)

plugwise/stick.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ def send(self, request, callback=None, retry_counter=0):
584584
)
585585

586586
def _send_message_loop(self):
587-
""" daemon to send messages waiting in queue """
587+
"""Daemon to send messages waiting in queue."""
588588
while self._run_send_message_thread:
589589
try:
590590
request_set = self._send_message_queue.get(block=True, timeout=1)
@@ -671,7 +671,7 @@ def _send_message_loop(self):
671671
_LOGGER.debug("Send message loop stopped")
672672

673673
def _receive_timeout_loop(self):
674-
""" daemon to time out requests without any (n)ack response message """
674+
"""Daemon to time out requests without any (n)ack response message."""
675675
while self._run_receive_timeout_thread:
676676
for seq_id in list(self.expected_responses.keys()):
677677
if self.expected_responses[seq_id][4] is not None:

0 commit comments

Comments
 (0)