Skip to content
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
6 changes: 3 additions & 3 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name: Latest commit

env:
CACHE_VERSION: 2
CACHE_VERSION: 3
DEFAULT_PYTHON: "3.10"
PRE_COMMIT_HOME: ~/.cache/pre-commit

Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
needs: commitcheck
strategy:
matrix:
python-version: [3.9, "3.10"]
python-version: [3.9, "3.10", "3.11"]
steps:
- name: Check out committed code
uses: actions/checkout@v3
Expand Down Expand Up @@ -199,7 +199,7 @@ jobs:
needs: prepare-test-cache
strategy:
matrix:
python-version: [3.9, "3.10"]
python-version: [3.9, "3.10", "3.11"]

steps:
- name: Check out committed code
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ default_language_version:
repos:
# Run manually in CI skipping the branch checks
- repo: https://github.com/PyCQA/isort
rev: 5.11.4
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -26,7 +26,7 @@ repos:
- id: pyupgrade
args: [--py39-plus]
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
args:
Expand Down
20 changes: 9 additions & 11 deletions plugwise/connections/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,14 @@ def _open_connection(self):
err,
)
raise PortError(err)
else:
self._reader_start("socket_reader_thread")
self._writer_start("socket_writer_thread")
self._is_connected = True
_LOGGER.debug(
"Successfully connected to host '%s' at port %s",
self._socket_host,
str(self._socket_port),
)
self._reader_start("socket_reader_thread")
self._writer_start("socket_writer_thread")
self._is_connected = True
_LOGGER.debug(
"Successfully connected to host '%s' at port %s",
self._socket_host,
str(self._socket_port),
)

def _close_connection(self):
"""Close the socket."""
Expand Down Expand Up @@ -76,8 +75,7 @@ def _read_data(self):
)
self._is_connected = False
raise PortError(err)
else:
return socket_data
return socket_data
return None

def _write_data(self, data):
Expand Down
7 changes: 3 additions & 4 deletions plugwise/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ def __init__(
):
"""Set the constructor for this class."""
if not websession:

aio_timeout = ClientTimeout(total=timeout)

async def _create_session() -> ClientSession:
Expand Down Expand Up @@ -303,7 +302,9 @@ async def _request(
data=data,
auth=self._auth,
)
except ClientError as err: # ClientError is an ancestor class of ServerTimeoutError
except (
ClientError
) as err: # ClientError is an ancestor class of ServerTimeoutError
if retry < 1:
LOGGER.warning(
"Failed sending %s %s to Plugwise Smile, error: %s",
Expand Down Expand Up @@ -1014,7 +1015,6 @@ def _get_appliance_data(self, d_id: str) -> DeviceData:
if (
appliance := self._appliances.find(f'./appliance[@id="{d_id}"]')
) is not None:

self._appliance_measurements(appliance, data, measurements)
self._get_lock_state(appliance, data)

Expand Down Expand Up @@ -1082,7 +1082,6 @@ def _rank_thermostat(
appl_class = appliance_details["dev_class"]
appl_d_loc = appliance_details["location"]
if loc_id == appl_d_loc and appl_class in thermo_matching:

# Pre-elect new master
if thermo_matching[appl_class] > self._thermo_locs[loc_id]["master_prio"]:
# Demote former master
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Home Automation",
]
authors = [
Expand Down Expand Up @@ -50,7 +51,7 @@ include-package-data = true
include = ["plugwise*"]

[tool.black]
target-version = ["py39", "py310"]
target-version = ["py39", "py310", "py311"]
exclude = 'generated'

[tool.isort]
Expand Down Expand Up @@ -166,9 +167,8 @@ expected-line-ending-format = "LF"

[tool.pylint.EXCEPTIONS]
overgeneral-exceptions = [
"BaseException",
"Exception",
"HomeAssistantError",
"builtins.BaseException",
"builtins.Exception",
]

[tool.pytest.ini_options]
Expand All @@ -187,7 +187,7 @@ norecursedirs = [
]

[tool.mypy]
python_version = "3.10"
python_version = "3.11"
show_error_codes = true
follow_imports = "silent"
ignore_missing_imports = true
Expand Down
2 changes: 1 addition & 1 deletion scripts/python-venv.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -eu

pyversions=(3.10 3.9)
pyversions=(3.11 3.10 3.9)
my_path=$(git rev-parse --show-toplevel)
my_venv=${my_path}/venv

Expand Down