Skip to content

Commit 767bac8

Browse files
authored
Setup black. (#895)
1 parent 2bc8b0d commit 767bac8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2231
-1352
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ jobs:
192192
- name: flake8
193193
tox: flake8
194194
# continue_on_error: true
195+
- name: black
196+
tox: black
197+
# continue_on_error: true
195198
- name: Docs
196199
tox: docs
197200
os:

pymodbus/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import logging as __logging
1313
from logging import NullHandler as __null
1414
import pymodbus.version as __version
15+
1516
__version__ = __version.version.short()
1617
__author__ = "Galen Collins"
1718
__maintainer__ = "dhoomakethu"

pymodbus/bit_read_message.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def execute(self, context):
146146
:param context: The datastore to request from
147147
:returns: The initializes response message, exception message otherwise
148148
"""
149-
if not 1 <= self.count <= 0x7d0:
149+
if not 1 <= self.count <= 0x7D0:
150150
return self.doException(merror.IllegalValue)
151151
if not context.validate(self.function_code, self.address, self.count):
152152
return self.doException(merror.IllegalAddress)
@@ -207,7 +207,7 @@ def execute(self, context):
207207
:param context: The datastore to request from
208208
:returns: The initializes response message, exception message otherwise
209209
"""
210-
if not 1 <= self.count <= 0x7d0:
210+
if not 1 <= self.count <= 0x7D0:
211211
return self.doException(merror.IllegalValue)
212212
if not context.validate(self.function_code, self.address, self.count):
213213
return self.doException(merror.IllegalAddress)
@@ -243,6 +243,8 @@ def __init__(self, values=None, **kwargs):
243243
# Exported symbols
244244
# ---------------------------------------------------------------------------#
245245
__all__ = [
246-
"ReadCoilsRequest", "ReadCoilsResponse",
247-
"ReadDiscreteInputsRequest", "ReadDiscreteInputsResponse",
246+
"ReadCoilsRequest",
247+
"ReadCoilsResponse",
248+
"ReadDiscreteInputsRequest",
249+
"ReadDiscreteInputsResponse",
248250
]

pymodbus/bit_write_message.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def decode(self, data):
6565
:param data: The packet data to decode
6666
"""
6767
self.address, value = struct.unpack(">HH", data)
68-
self.value = (value == ModbusStatus.On)
68+
self.value = value == ModbusStatus.On
6969

7070
def execute(self, context):
7171
"""Run a write coil request against a datastore.
@@ -135,7 +135,7 @@ def decode(self, data):
135135
:param data: The packet data to decode
136136
"""
137137
self.address, value = struct.unpack(">HH", data)
138-
self.value = (value == ModbusStatus.On)
138+
self.value = value == ModbusStatus.On
139139

140140
def __str__(self):
141141
"""Return a string representation of the instance.
@@ -202,7 +202,7 @@ def execute(self, context):
202202
:returns: The populated response or exception message
203203
"""
204204
count = len(self.values)
205-
if not 1 <= count <= 0x07b0:
205+
if not 1 <= count <= 0x07B0:
206206
return self.doException(merror.IllegalValue)
207207
if self.byte_count != (count + 7) // 8:
208208
return self.doException(merror.IllegalValue)
@@ -218,7 +218,9 @@ def __str__(self):
218218
:returns: A string representation of the instance
219219
"""
220220
params = (self.address, len(self.values))
221-
return "WriteNCoilRequest (%d) => %d " % params # pylint: disable=consider-using-f-string
221+
return (
222+
"WriteNCoilRequest (%d) => %d " % params # pylint: disable=consider-using-f-string
223+
)
222224

223225
def get_response_pdu_size(self): # pylint: disable=no-self-use
224226
"""Get response pdu size.
@@ -274,6 +276,8 @@ def __str__(self):
274276
# Exported symbols
275277
# ---------------------------------------------------------------------------#
276278
__all__ = [
277-
"WriteSingleCoilRequest", "WriteSingleCoilResponse",
278-
"WriteMultipleCoilsRequest", "WriteMultipleCoilsResponse",
279+
"WriteSingleCoilRequest",
280+
"WriteSingleCoilResponse",
281+
"WriteMultipleCoilsRequest",
282+
"WriteMultipleCoilsResponse",
279283
]

pymodbus/client/asynchronous/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@
3737
if installed := importlib.util.find_spec("twisted"):
3838
# Import deprecated async client only if twisted is installed #338
3939
from pymodbus.client.asynchronous.deprecated.asynchronous import * # noqa: F401,F403
40-
_logger.warning("Importing deprecated clients. "
41-
"Dependency Twisted is Installed")
40+
41+
_logger.warning("Importing deprecated clients. Dependency Twisted is Installed")

0 commit comments

Comments
 (0)