Skip to content
Open
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ repos:
- id: check-ast
- id: check-toml
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
rev: v2.3.0
hooks:
- id: mypy
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.10
rev: v0.16.2
hooks:
- id: ruff-check
args: [ --fix, --config=ruff.toml ]
Expand Down
6 changes: 3 additions & 3 deletions src/pyvesync/base_devices/outlet_base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Base Devices for Outlets."""

Check failure on line 1 in src/pyvesync/base_devices/outlet_base.py

View workflow job for this annotation

GitHub Actions / build (3.12)

ruff (CPY001)

src/pyvesync/base_devices/outlet_base.py:1:1: CPY001 Missing copyright notice at top of file

Check failure on line 1 in src/pyvesync/base_devices/outlet_base.py

View workflow job for this annotation

GitHub Actions / build (3.11)

ruff (CPY001)

src/pyvesync/base_devices/outlet_base.py:1:1: CPY001 Missing copyright notice at top of file

Check failure on line 1 in src/pyvesync/base_devices/outlet_base.py

View workflow job for this annotation

GitHub Actions / build (3.13)

ruff (CPY001)

src/pyvesync/base_devices/outlet_base.py:1:1: CPY001 Missing copyright notice at top of file

Check failure on line 1 in src/pyvesync/base_devices/outlet_base.py

View workflow job for this annotation

GitHub Actions / build (3.13)

ruff (CPY001)

src/pyvesync/base_devices/outlet_base.py:1:1: CPY001 Missing copyright notice at top of file

Check failure on line 1 in src/pyvesync/base_devices/outlet_base.py

View workflow job for this annotation

GitHub Actions / build (3.12)

ruff (CPY001)

src/pyvesync/base_devices/outlet_base.py:1:1: CPY001 Missing copyright notice at top of file

Check failure on line 1 in src/pyvesync/base_devices/outlet_base.py

View workflow job for this annotation

GitHub Actions / build (3.11)

ruff (CPY001)

src/pyvesync/base_devices/outlet_base.py:1:1: CPY001 Missing copyright notice at top of file

from __future__ import annotations

Expand Down Expand Up @@ -113,7 +113,7 @@
self.protectionStatus: str | None = None
self.currentUpperThreshold: float | None = None

def annual_history_to_json(self) -> None | str:
def annual_history_to_json(self) -> str | None:
"""Dump annual history."""
if not self.device.supports_energy:
logger.info('Device does not support energy monitoring.')
Expand All @@ -123,7 +123,7 @@
return None
return self.yearly_history.to_json()

def monthly_history_to_json(self) -> None | str:
def monthly_history_to_json(self) -> str | None:
"""Dump monthly history."""
if not self.device.supports_energy:
logger.info('Device does not support energy monitoring.')
Expand All @@ -133,7 +133,7 @@
return None
return self.monthly_history.to_json()

def weekly_history_to_json(self) -> None | str:
def weekly_history_to_json(self) -> str | None:
"""Dump weekly history."""
if not self.device.supports_energy:
logger.info('Device does not support energy monitoring.')
Expand Down
4 changes: 2 additions & 2 deletions src/pyvesync/devices/vesyncpurifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ async def set_auto_preference(self, preference: str, room_size: int = 800) -> bo
self.state.auto_room_size = room_size
return True

async def set_fan_speed(self, speed: None | int = None) -> bool:
async def set_fan_speed(self, speed: int | None = None) -> bool:
speeds: list = self.fan_levels
current_speed = self.state.fan_level

Expand Down Expand Up @@ -674,7 +674,7 @@ async def set_auto_preference(
self.state.connection_status = ConnectionStatus.ONLINE
return True

async def set_fan_speed(self, speed: None | int = None) -> bool:
async def set_fan_speed(self, speed: int | None = None) -> bool:
if speed is not None:
if speed not in self.fan_levels:
_LOGGER.warning(
Expand Down
4 changes: 2 additions & 2 deletions src/pyvesync/models/bulb_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
class JSONCMD(DataClassORJSONMixin):
"""Tunable Bulb JSON CMD dict."""

light: None | JSONCMDLight = None
getLightStatus: None | str = None
light: JSONCMDLight | None = None
getLightStatus: str | None = None

class Config(BaseConfig):
"""Configure the JSONCMD model."""
Expand Down
2 changes: 1 addition & 1 deletion src/pyvesync/models/purifier_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class PurifierCoreDetailsConfig(ResponseBaseModel):

display: bool
display_forever: bool
auto_preference: None | PurifierCoreAutoConfig = None
auto_preference: PurifierCoreAutoConfig | None = None


@dataclass
Expand Down
8 changes: 4 additions & 4 deletions src/pyvesync/models/vesync_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ class InternalDeviceListExtension(ResponseBaseModel):
the extension field in the device list response.
"""

airQuality: None | int
airQualityLevel: None | int
mode: None | str
fanSpeedLevel: None | str
airQuality: int | None
airQualityLevel: int | None
mode: str | None
fanSpeedLevel: str | None


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion src/pyvesync/utils/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def __init__(self) -> None:
class VeSyncAPIResponseError(VeSyncError):
"""Exception raised for malformed VeSync API responses."""

def __init__(self, msg: None | str = None) -> None:
def __init__(self, msg: str | None = None) -> None:
"""Initialize the exception with a message."""
if msg is None:
msg = 'Unexpected VeSync API response.'
Expand Down
2 changes: 1 addition & 1 deletion src/pyvesync/vesync.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ async def async_call_api(
self,
api: str,
method: str,
json_object: dict | None | DataClassORJSONMixin = None,
json_object: dict | DataClassORJSONMixin | None = None,
headers: dict | None = None,
device: VeSyncBaseDevice | None = None,
) -> tuple[dict | None, int]:
Expand Down
Loading