Skip to content

Commit

Permalink
Enable ANN202 rule (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
joostlek authored Feb 6, 2025
1 parent cf55bad commit 85b1dfa
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 39 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ asyncio_mode = "auto"
ignore = [
"ANN401", # Opinioated warning on disallowing dynamically typed expressions
"ANN204",
"ANN202",
"DTZ005",
"PLR0913",
"TRY003",
Expand Down
2 changes: 1 addition & 1 deletion src/pysmartthings/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def session(self) -> ClientSession:
return self._session

@session.setter
def session(self, value: ClientSession):
def session(self, value: ClientSession) -> None:
"""Set the instance of the session."""
self._session = value

Expand Down
16 changes: 8 additions & 8 deletions src/pysmartthings/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def app_name(self) -> str:
return self._app_name

@app_name.setter
def app_name(self, value: str):
def app_name(self, value: str) -> None:
"""Set the app name."""
if not value:
msg = "value cannot be None or zero length."
Expand Down Expand Up @@ -136,7 +136,7 @@ def description(self) -> str:
return self._description

@description.setter
def description(self, value: str):
def description(self, value: str) -> None:
"""Set the description."""
if not value:
msg = "value cannot be None or zero length."
Expand All @@ -156,7 +156,7 @@ def single_instance(self) -> bool:
return self._single_instance

@single_instance.setter
def single_instance(self, value: bool):
def single_instance(self, value: bool) -> None:
"""Set the single instance parameter."""
self._single_instance = bool(value)

Expand All @@ -166,7 +166,7 @@ def classifications(self) -> list[str]:
return self._classifications

@classifications.setter
def classifications(self, value: list[str]):
def classifications(self, value: list[str]) -> None:
"""Set the classifications of the app."""
self._classifications = list(value)

Expand All @@ -179,7 +179,7 @@ def app_type(self) -> str:
return self._app_type

@app_type.setter
def app_type(self, value: str):
def app_type(self, value: str) -> None:
"""Set the app type."""
if value not in (APP_TYPE_LAMBDA, APP_TYPE_WEBHOOK):
msg = "value must be 'LAMBDA_SMART_APP' or 'WEBHOOK_SMART_APP'"
Expand All @@ -201,7 +201,7 @@ def webhook_target_url(self) -> str:
return self._webhook_target_url

@webhook_target_url.setter
def webhook_target_url(self, value: str):
def webhook_target_url(self, value: str) -> None:
"""Set the URL that should be invoked during execution."""
self._webhook_target_url = value

Expand Down Expand Up @@ -238,7 +238,7 @@ def settings(self) -> dict:
return self._settings

@settings.setter
def settings(self, value: dict):
def settings(self, value: dict) -> None:
"""Set the settings for the app."""
self._settings = value

Expand Down Expand Up @@ -301,7 +301,7 @@ def client_name(self) -> str:
return self._client_name

@client_name.setter
def client_name(self, value: str):
def client_name(self, value: str) -> None:
"""Set the name given to the OAuth client."""
if not value:
msg = "Value can not be None or an empty string."
Expand Down
34 changes: 17 additions & 17 deletions src/pysmartthings/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def color(self) -> str | None:
return self._attributes[Attribute.color].value

@color.setter
def color(self, value: str):
def color(self, value: str) -> None:
"""Set the color attribute."""
if not COLOR_HEX_MATCHER.match(value):
msg = "value was not a properly formatted color hex, i.e. #000000."
Expand All @@ -262,7 +262,7 @@ def color_temperature(self) -> int:
return int(self._attributes[Attribute.color_temperature].value or 1)

@color_temperature.setter
def color_temperature(self, value: int):
def color_temperature(self, value: int) -> None:
"""Set the color temperature attribute."""
if not 1 <= value <= 30000:
msg = "value must be scaled between 1-30000."
Expand All @@ -280,7 +280,7 @@ def fan_speed(self) -> int:
return int(self._attributes[Attribute.fan_speed].value or 0)

@fan_speed.setter
def fan_speed(self, value: int):
def fan_speed(self, value: int) -> None:
"""Set the fan speed attribute."""
if value < 0:
msg = "value must be >= 0."
Expand All @@ -293,7 +293,7 @@ def hue(self) -> float:
return float(self._attributes[Attribute.hue].value or 0.0)

@hue.setter
def hue(self, value: float):
def hue(self, value: float) -> None:
"""Set the hue attribute, scaled 0-100."""
if not 0 <= value <= 100:
msg = "value must be scaled between 0-100."
Expand All @@ -306,7 +306,7 @@ def level(self) -> int:
return int(self._attributes[Attribute.level].value or 0)

@level.setter
def level(self, value: int):
def level(self, value: int) -> None:
"""Set the level of the attribute, scaled 0-100."""
if not 0 <= value <= 100:
msg = "value must be scaled between 0-100."
Expand All @@ -319,7 +319,7 @@ def saturation(self) -> float:
return float(self._attributes[Attribute.saturation].value or 0.0)

@saturation.setter
def saturation(self, value: float):
def saturation(self, value: float) -> None:
"""Set the saturation attribute, scaled 0-100."""
if not 0 <= value <= 100:
msg = "value must be scaled between 0-100."
Expand All @@ -337,7 +337,7 @@ def switch(self) -> bool:
return self.is_on(Attribute.switch)

@switch.setter
def switch(self, value: bool):
def switch(self, value: bool) -> None:
"""Set the value of the switch attribute."""
status_value = bool_to_value(Attribute.switch, value)
self.update_attribute_value(Attribute.switch, status_value)
Expand Down Expand Up @@ -393,7 +393,7 @@ def cooling_setpoint(self) -> int | None:
return self._attributes[Attribute.cooling_setpoint].value

@cooling_setpoint.setter
def cooling_setpoint(self, value: int):
def cooling_setpoint(self, value: int) -> None:
"""Set the coolingSetpoint attribute."""
self.update_attribute_value(Attribute.cooling_setpoint, value)

Expand Down Expand Up @@ -662,7 +662,7 @@ def mute(self) -> bool:
return self.is_on(Attribute.mute)

@mute.setter
def mute(self, value: bool):
def mute(self, value: bool) -> None:
"""Set the mute attribute."""
status_value = bool_to_value(Attribute.mute, value)
self.update_attribute_value(Attribute.mute, status_value)
Expand All @@ -673,7 +673,7 @@ def volume(self) -> int:
return self._attributes[Attribute.volume].value

@volume.setter
def volume(self, value: float):
def volume(self, value: float) -> None:
"""Set the volume attribute, scaled 0-100."""
if not 0 <= value <= 100:
msg = "value must be scaled between 0-100."
Expand All @@ -686,7 +686,7 @@ def playback_status(self) -> str:
return self._attributes[Attribute.playback_status].value

@playback_status.setter
def playback_status(self, value: str):
def playback_status(self, value: str) -> None:
"""Set the playbackStatus attribute."""
self.update_attribute_value(Attribute.playback_status, value)

Expand All @@ -696,7 +696,7 @@ def input_source(self) -> str:
return self._attributes[Attribute.input_source].value

@input_source.setter
def input_source(self, value: str):
def input_source(self, value: str) -> None:
"""Set the volume attribute."""
if value not in self.supported_input_sources:
msg = "value must be supported."
Expand All @@ -717,7 +717,7 @@ def playback_shuffle(self) -> bool:
return self.is_on(Attribute.playback_shuffle)

@playback_shuffle.setter
def playback_shuffle(self, value: bool):
def playback_shuffle(self, value: bool) -> None:
"""Set the playbackShuffle attribute."""
status_value = bool_to_value(Attribute.playback_shuffle, value)
self.update_attribute_value(Attribute.playback_shuffle, status_value)
Expand All @@ -728,7 +728,7 @@ def playback_repeat_mode(self) -> str:
return self._attributes[Attribute.playback_repeat_mode].value

@playback_repeat_mode.setter
def playback_repeat_mode(self, value: str):
def playback_repeat_mode(self, value: str) -> None:
"""Set the playbackRepeatMode attribute."""
if value not in ["all", "off", "one"]:
msg = "value must be one of: all, off, one"
Expand All @@ -741,7 +741,7 @@ def tv_channel(self) -> str:
return self._attributes[Attribute.tv_channel].value

@tv_channel.setter
def tv_channel(self, value: str):
def tv_channel(self, value: str) -> None:
"""Set the tvChannel attribute."""
self.update_attribute_value(Attribute.tv_channel, value)

Expand All @@ -756,7 +756,7 @@ def shade_level(self) -> int:
return int(self._attributes[Attribute.shade_level].value or 0)

@shade_level.setter
def shade_level(self, value: int):
def shade_level(self, value: int) -> None:
"""Set the level of the attribute, scaled 0-100."""
if not 0 <= value <= 100:
msg = "value must be scaled between 0-100."
Expand Down Expand Up @@ -825,7 +825,7 @@ def device_id(self) -> str:
return self._device_id

@device_id.setter
def device_id(self, value: str):
def device_id(self, value: str) -> None:
"""Set the device id."""
self._device_id = value

Expand Down
8 changes: 4 additions & 4 deletions src/pysmartthings/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def room_id(self) -> str:
return self._room_id

@room_id.setter
def room_id(self, value: str):
def room_id(self, value: str) -> None:
"""Set the id of the room."""
self._room_id = value

Expand All @@ -50,7 +50,7 @@ def location_id(self) -> str:
return self._location_id

@location_id.setter
def location_id(self, value: str):
def location_id(self, value: str) -> None:
"""Set the location id of the room."""
self._location_id = value

Expand All @@ -60,7 +60,7 @@ def name(self) -> str:
return self._name

@name.setter
def name(self, value: str):
def name(self, value: str) -> None:
"""Set the name of the room."""
self._name = value

Expand All @@ -70,7 +70,7 @@ def background_image(self) -> str:
return self._background_image

@background_image.setter
def background_image(self, value: str):
def background_image(self, value: str) -> None:
"""Set the background image."""
self._background_image = value

Expand Down
14 changes: 7 additions & 7 deletions src/pysmartthings/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def installed_app_id(self) -> str:
return self._installed_app_id

@installed_app_id.setter
def installed_app_id(self, value: str):
def installed_app_id(self, value: str) -> None:
"""Set the id of the subscripting app."""
self._installed_app_id = value

Expand All @@ -117,7 +117,7 @@ def source_type(self) -> SourceType:
return self._source_type

@source_type.setter
def source_type(self, value: Any):
def source_type(self, value: Any) -> None:
"""Set the typ eof event that is being subscribed to."""
self._source_type = SourceType(value)

Expand All @@ -127,7 +127,7 @@ def capability(self) -> str:
return self._capability

@capability.setter
def capability(self, value: str):
def capability(self, value: str) -> None:
"""Get the name of the capability that is subscribed."""
self._capability = value

Expand All @@ -137,7 +137,7 @@ def attribute(self) -> str:
return self._attribute

@attribute.setter
def attribute(self, value: str):
def attribute(self, value: str) -> None:
"""Set the name of the capabilities attribute or * for all."""
self._attribute = value

Expand All @@ -147,7 +147,7 @@ def value(self) -> str:
return self._value

@value.setter
def value(self, value: str):
def value(self, value: str) -> None:
"""Set the value for that will trigger the subscription."""
self._value = value

Expand All @@ -157,7 +157,7 @@ def state_change_only(self) -> bool:
return self._state_change_only

@state_change_only.setter
def state_change_only(self, value: bool):
def state_change_only(self, value: bool) -> None:
"""Set to execute only on a state change."""
self._state_change_only = value

Expand All @@ -167,7 +167,7 @@ def subscription_name(self) -> str:
return self._subscription_name

@subscription_name.setter
def subscription_name(self, value: str):
def subscription_name(self, value: str) -> None:
"""Set a name for the subscription."""
self._subscription_name = value

Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import glob
import re

from aiohttp import ClientSession
from pysmartthings.api import (
API_APP,
API_APP_OAUTH,
Expand Down Expand Up @@ -224,5 +225,5 @@ def api(event_loop):
event_loop.run_until_complete(session.close())


async def __create_session(event_loop, mocker):
async def __create_session(event_loop, mocker) -> ClientSession:
return mocker.create_session(event_loop)

0 comments on commit 85b1dfa

Please sign in to comment.