Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ruff to 0.0.277 #1689

Merged
merged 3 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
- id: check-added-large-files
# run ruff with --fix before black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.263'
rev: 'v0.0.277'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
4 changes: 2 additions & 2 deletions examples/client_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ async def async_template_call(client):
raise ModbusException(txt)

# Validate data
txt = f"### Template coils response: {str(rr.bits)}"
txt = f"### Template coils response: {rr.bits!s}"
_logger.debug(txt)


Expand All @@ -102,7 +102,7 @@ def template_call(client):
raise ModbusException(txt)

# Validate data
txt = f"### Template coils response: {str(rr.bits)}"
txt = f"### Template coils response: {rr.bits!s}"
_logger.debug(txt)


Expand Down
2 changes: 1 addition & 1 deletion examples/server_updating.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def updating_task(context):
address = 0x10
values = context[slave_id].getValues(fc_as_hex, address, count=5)
values = [v + 1 for v in values] # increment by 1.
txt = f"new values: {str(values)}"
txt = f"new values: {values!s}"
_logger.debug(txt)
context[slave_id].setValues(fc_as_hex, address, values)
await asyncio.sleep(1)
Expand Down
4 changes: 2 additions & 2 deletions pymodbus/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ def execute(self, request: ModbusRequest = None) -> ModbusResponse:
"""
if self.use_sync:
if not self.connected:
raise ConnectionException(f"Failed to connect[{str(self)}]")
raise ConnectionException(f"Failed to connect[{self!s}]")
return self.transaction.execute(request)
if not self.transport:
raise ConnectionException(f"Not connected[{str(self)}]")
raise ConnectionException(f"Not connected[{self!s}]")
return self.async_execute(request)

# ----------------------------------------------------------------------- #
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pytest-asyncio>=0.20.3
pytest-cov>=4.1.0
pytest-timeout>=2.1.0
pytest-xdist>=3.3.1
ruff>=0.0.261
ruff>=0.0.277
types-Pygments
types-pyserial
twine>=4.0.2
2 changes: 2 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ignore = [
"S101", # Use of `assert`
"S311", # PRNG for cryptography
"S104", # binding on all interfaces
"RUF012", # typing.ClassVar
"RUF013", # implicit Optional
]
line-length = 120
select = [
Expand Down