mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Update ruff to 0.9 (#1482)
Some checks are pending
CI / Perform linting checks (3.13) (push) Waiting to run
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Blocked by required conditions
CodeQL checks / Analyze (python) (push) Waiting to run
Some checks are pending
CI / Perform linting checks (3.13) (push) Waiting to run
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, macos-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, ubuntu-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (false, windows-latest, 3.13) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.11) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.12) (push) Blocked by required conditions
CI / Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} (true, ubuntu-latest, 3.13) (push) Blocked by required conditions
CodeQL checks / Analyze (python) (push) Waiting to run
Ruff 0.9 contains a number of formatter changes for the 2025 style guide. Update to `ruff>=0.9.0` and apply the formatter fixes. https://astral.sh/blog/ruff-v0.9.0
This commit is contained in:
@@ -66,8 +66,8 @@ async def hub_pair(dev: SmartDevice, timeout: int):
|
||||
|
||||
for child in pair_res:
|
||||
echo(
|
||||
f'Paired {child["name"]} ({child["device_model"]}, '
|
||||
f'{pretty_category(child["category"])}) with id {child["device_id"]}'
|
||||
f"Paired {child['name']} ({child['device_model']}, "
|
||||
f"{pretty_category(child['category'])}) with id {child['device_id']}"
|
||||
)
|
||||
|
||||
|
||||
|
@@ -66,7 +66,6 @@ class LazyGroup(click.Group):
|
||||
# check the result to make debugging easier
|
||||
if not isinstance(cmd_object, click.BaseCommand):
|
||||
raise ValueError(
|
||||
f"Lazy loading of {cmd_name} failed by returning "
|
||||
"a non-command object"
|
||||
f"Lazy loading of {cmd_name} failed by returning a non-command object"
|
||||
)
|
||||
return cmd_object
|
||||
|
@@ -115,9 +115,7 @@ class IotDimmer(IotPlug):
|
||||
raise KasaException("Device is not dimmable.")
|
||||
|
||||
if not isinstance(brightness, int):
|
||||
raise ValueError(
|
||||
"Brightness must be integer, " "not of %s.", type(brightness)
|
||||
)
|
||||
raise ValueError("Brightness must be integer, not of %s.", type(brightness))
|
||||
|
||||
if not 0 <= brightness <= 100:
|
||||
raise ValueError(
|
||||
|
@@ -54,7 +54,7 @@ class LightPreset(IotModule, LightPresetInterface):
|
||||
async def _post_update_hook(self) -> None:
|
||||
"""Update the internal presets."""
|
||||
self._presets = {
|
||||
f"Light preset {index+1}": IotLightPreset.from_dict(vals)
|
||||
f"Light preset {index + 1}": IotLightPreset.from_dict(vals)
|
||||
for index, vals in enumerate(self.data["preferred_state"])
|
||||
# Devices may list some light effects along with normal presets but these
|
||||
# are handled by the LightEffect module so exclude preferred states with id
|
||||
|
@@ -30,7 +30,7 @@ def _mask_children(children: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
def mask_child(child: dict[str, Any], index: int) -> dict[str, Any]:
|
||||
result = {
|
||||
**child,
|
||||
"id": f"SCRUBBED_CHILD_DEVICE_ID_{index+1}",
|
||||
"id": f"SCRUBBED_CHILD_DEVICE_ID_{index + 1}",
|
||||
}
|
||||
# Will leave empty aliases as blank
|
||||
if child.get("alias"):
|
||||
|
@@ -236,7 +236,7 @@ class SmartProtocol(BaseProtocol):
|
||||
|
||||
smart_params = {"requests": requests_step}
|
||||
smart_request = self.get_smart_request(smart_method, smart_params)
|
||||
batch_name = f"multi-request-batch-{batch_num+1}-of-{int(end/step)+1}"
|
||||
batch_name = f"multi-request-batch-{batch_num + 1}-of-{int(end / step) + 1}"
|
||||
if debug_enabled:
|
||||
_LOGGER.debug(
|
||||
"%s %s >> %s",
|
||||
|
@@ -142,18 +142,16 @@ class XorTransport(BaseTransport):
|
||||
await self.reset()
|
||||
if ex.errno in _NO_RETRY_ERRORS:
|
||||
raise KasaException(
|
||||
f"Unable to connect to the device:"
|
||||
f" {self._host}:{self._port}: {ex}"
|
||||
f"Unable to connect to the device: {self._host}:{self._port}: {ex}"
|
||||
) from ex
|
||||
else:
|
||||
raise _RetryableError(
|
||||
f"Unable to connect to the device:"
|
||||
f" {self._host}:{self._port}: {ex}"
|
||||
f"Unable to connect to the device: {self._host}:{self._port}: {ex}"
|
||||
) from ex
|
||||
except Exception as ex:
|
||||
await self.reset()
|
||||
raise _RetryableError(
|
||||
f"Unable to connect to the device:" f" {self._host}:{self._port}: {ex}"
|
||||
f"Unable to connect to the device: {self._host}:{self._port}: {ex}"
|
||||
) from ex
|
||||
except BaseException:
|
||||
# Likely something cancelled the task so we need to close the connection
|
||||
|
Reference in New Issue
Block a user