mirror of https://github.com/Nonannet/pyhoff.git
Compare commits
No commits in common. "5aab2d6d74a9a49118584ceb481d6f3e71c2c613" and "25a79dda1b388fe80c90052ffe97d432c937c6f5" have entirely different histories.
5aab2d6d74
...
25a79dda1b
1
.flake8
1
.flake8
|
@ -14,7 +14,6 @@ exclude =
|
|||
dist,
|
||||
.conda
|
||||
.venv
|
||||
venv
|
||||
|
||||
# Enable specific plugins or options
|
||||
# Example: Enabling flake8-docstrings
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
name: CI Pipeline
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.10", 3.11, 3.12, 3.13]
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install -e .[dev]
|
||||
|
||||
- name: Lint code with flake8
|
||||
run: flake8
|
||||
|
||||
- name: Type checking with mypy
|
||||
run: mypy
|
||||
|
||||
- name: Run tests with pytest
|
||||
run: pytest
|
|
@ -45,8 +45,8 @@ class BusTerminal():
|
|||
@classmethod
|
||||
def select(cls, bus_coupler: 'BusCoupler', terminal_number: int = 0) -> 'BusTerminal':
|
||||
terminal_list = [bt for bt in bus_coupler.bus_terminals if isinstance(bt, cls)]
|
||||
assert terminal_list, f"No instance of {cls.__name__} configured at this BusCoupler"
|
||||
assert 0 <= terminal_number < len(terminal_list), f"Out of range, select in range: 0..{len(terminal_list) - 1}"
|
||||
assert terminal_list, f'No instance of {cls.__name__} configured at this BusCoupler'
|
||||
assert 0 <= terminal_number < len(terminal_list), f'Out of range, select in range: 0..{len(terminal_list) - 1}'
|
||||
return terminal_list[terminal_number]
|
||||
|
||||
|
||||
|
@ -283,7 +283,7 @@ class BusCoupler():
|
|||
terminal_classes.append(element)
|
||||
|
||||
for terminal_class in terminal_classes:
|
||||
assert _is_bus_terminal(terminal_class), f"{terminal_class} is not a bus terminal"
|
||||
assert _is_bus_terminal(terminal_class), f'{terminal_class} is not a bus terminal'
|
||||
|
||||
def get_para(key: str) -> int:
|
||||
return terminal_class.parameters.get(key, 0)
|
||||
|
|
|
@ -451,7 +451,7 @@ class SimpleModbusClient:
|
|||
return bytes()
|
||||
|
||||
if self.debug:
|
||||
print(f"<- Received: {' '.join(hex(b) for b in buffer)}")
|
||||
print(f'<- Received: {' '.join(hex(b) for b in buffer)}')
|
||||
|
||||
return buffer
|
||||
|
||||
|
@ -471,7 +471,7 @@ class SimpleModbusClient:
|
|||
try:
|
||||
self._socket.sendall(data)
|
||||
if self.debug:
|
||||
print(f"-> Send: {' '.join(hex(b) for b in data)}")
|
||||
print(f'-> Send: {' '.join(hex(b) for b in data)}')
|
||||
return len(data)
|
||||
except socket.error:
|
||||
self.last_error = 'sending data failed'
|
||||
|
@ -532,7 +532,7 @@ class SimpleModbusClient:
|
|||
return self.close()
|
||||
|
||||
if data[0] > 0x80:
|
||||
self.last_error = f"return error: {_modbus_exceptions.get(data[1], '')} ({data[1]})"
|
||||
self.last_error = f'return error: {_modbus_exceptions.get(data[1], '')} ({data[1]})'
|
||||
if self.debug:
|
||||
print(self.last_error)
|
||||
return bytes()
|
||||
|
|
|
@ -14,7 +14,7 @@ def test_against_old_traces():
|
|||
|
||||
# dummy modbus send function
|
||||
def debug_send_dummy(data: bytes) -> int:
|
||||
print(f"-> Send: {' '.join(hex(b) for b in data)}")
|
||||
print(f'-> Send: {' '.join(hex(b) for b in data)}')
|
||||
for b in data:
|
||||
debug_data.append(f"{b:02X}")
|
||||
return len(data)
|
||||
|
|
Loading…
Reference in New Issue