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 pyoverkiz/auth/strategies.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(

async def login(self) -> None:
"""Perform authentication; default is a no-op for subclasses to override."""
return None
return

async def refresh_if_needed(self) -> bool:
"""Refresh authentication tokens if needed; default returns False."""
Expand All @@ -78,7 +78,7 @@ def auth_headers(self, path: str | None = None) -> Mapping[str, str]:

async def close(self) -> None:
"""Close any resources held by the strategy; default is no-op."""
return None
return


class SessionLoginStrategy(BaseAuthStrategy):
Expand Down Expand Up @@ -269,7 +269,7 @@ def _client() -> BaseClient:
except ClientError as error:
code = error.response.get("Error", {}).get("Code")
if code in {"NotAuthorizedException", "UserNotFoundException"}:
raise NexityBadCredentialsError() from error
raise NexityBadCredentialsError from error
raise

id_token = tokens["AuthenticationResult"]["IdToken"]
Expand Down
9 changes: 3 additions & 6 deletions pyoverkiz/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,8 @@ def __init__(
self.gateways: list[Gateway] = []
self.event_listener_id: str | None = None

self.session = (
session
if session
else ClientSession(headers={"User-Agent": "python-overkiz-api"})
self.session = session or ClientSession(
headers={"User-Agent": "python-overkiz-api"}
)
self._ssl = verify_ssl

Expand Down Expand Up @@ -519,8 +517,7 @@ async def execute_action_group(
if self._action_queue:
queued = await self._action_queue.add(actions, mode, label)
return await queued
else:
return await self._execute_action_group_direct(actions, mode, label)
return await self._execute_action_group_direct(actions, mode, label)

async def flush_action_queue(self) -> None:
"""Force flush all pending actions in the queue immediately.
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ select = [
"TRY",
# flake8-quotes
"Q",
# refurb
"FURB",
# perflint
"PERF",
# flake8-raise
"RSE",
# flake8-return
"RET",
# flake8-pie
"PIE",
]
ignore = [
"E501", # Line too long
Expand Down
1 change: 0 additions & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,6 @@ async def json(self, content_type=None):

async def __aexit__(self, exc_type, exc, tb):
"""Context manager exit (noop)."""
pass

async def __aenter__(self):
"""Context manager enter returning self."""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def test_base_url_parsing(
"""Ensure device URL parsing extracts protocol, gateway and address correctly."""
test_device = {
**RAW_DEVICES,
**{"deviceURL": device_url},
"deviceURL": device_url,
}
device_data = decamelize(test_device)
device = Device(**device_data)
Expand All @@ -240,7 +240,7 @@ def test_invalid_device_url_raises(self, device_url: str):
"""Invalid device URLs should raise during identifier parsing."""
test_device = {
**RAW_DEVICES,
**{"deviceURL": device_url},
"deviceURL": device_url,
}
device_data = decamelize(test_device)

Expand Down
11 changes: 5 additions & 6 deletions utils/generate_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,11 @@ def clean_description(desc: str) -> str:

# Get parameter info
if cmd.prototype and cmd.prototype.parameters:
param_strs = []
for param in cmd.prototype.parameters:
if param.value_prototypes:
param_strs.append(
format_value_prototype(param.value_prototypes[0])
)
param_strs = [
format_value_prototype(param.value_prototypes[0])
for param in cmd.prototype.parameters
if param.value_prototypes
]
param_info = (
f"({', '.join(param_strs)})" if param_strs else "()"
)
Expand Down
Loading