Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable rest of the ANN rules #108

Merged
merged 2 commits into from
Feb 6, 2025
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
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,12 @@ asyncio_mode = "auto"
[tool.ruff.lint]
ignore = [
"ANN401", # Opinioated warning on disallowing dynamically typed expressions
"ANN204",
"DTZ005",
"PLR0913",
"TRY003",
"FBT002",
"ARG002",
"FBT001",
"ANN205",
"BLE001",
"S110",
"S105",
Expand Down
4 changes: 3 additions & 1 deletion src/pysmartthings/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ class Api:

__slots__ = ["_api_base", "_session", "_token"]

def __init__(self, session: ClientSession, token: str, *, api_base: str = API_BASE):
def __init__(
self, session: ClientSession, token: str, *, api_base: str = API_BASE
) -> None:
"""Create a new API with the given session and token."""
self._session = session
self._token = token
Expand Down
10 changes: 5 additions & 5 deletions src/pysmartthings/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class App:
"""Define the app class."""

def __init__(self):
def __init__(self) -> None:
"""Initialize a new instance of the App class."""
self._app_name = None
self._display_name = None
Expand Down Expand Up @@ -214,7 +214,7 @@ def webhook_public_key(self) -> str:
class AppSettings:
"""Define a SmartThings app settings."""

def __init__(self, app_id: str):
def __init__(self, app_id: str) -> None:
"""Create a new instance of the AppSettings class."""
self._app_id = app_id
self._settings = {}
Expand Down Expand Up @@ -275,7 +275,7 @@ async def save(self) -> None:
class AppOAuth:
"""Define the app OAuth settings."""

def __init__(self, app_id: str):
def __init__(self, app_id: str) -> None:
"""Initialize a new instance of the OAuth class."""
self._app_id = app_id
self._client_name = None
Expand Down Expand Up @@ -373,7 +373,7 @@ async def settings(self) -> AppSettingsEntity:
class AppOAuthClient:
"""Define an oauth client information."""

def __init__(self, data: dict | None):
def __init__(self, data: dict | None) -> None:
"""Create a new instance of the OAuthClient."""
self._client_id = None
self._client_secret = None
Expand All @@ -399,7 +399,7 @@ def client_secret(self) -> str:
class AppOAuthClientEntity(AppOAuthClient):
"""Define an oauth client information details."""

def __init__(self, api: Api, app_id: str, data: dict | None):
def __init__(self, api: Api, app_id: str, data: dict | None) -> None:
"""Init the class."""
self._client_details = AppOAuthEntity(api, app_id, None)
super().__init__(data)
Expand Down
6 changes: 3 additions & 3 deletions src/pysmartthings/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class Command:
class Device:
"""Represents a SmartThings device."""

def __init__(self):
def __init__(self) -> None:
"""Initialize a new device."""
self._device_id = None
self._name = None
Expand Down Expand Up @@ -215,7 +215,7 @@ class DeviceStatusBase:

def __init__(
self, component_id: str, attributes: Mapping[str, Status] | None = None
):
) -> None:
"""Initialize the status class."""
self._attributes = defaultdict(lambda: STATUS_NONE, attributes or {})
self._component_id = component_id
Expand Down Expand Up @@ -841,7 +841,7 @@ class DeviceEntity(Entity, Device):

def __init__(
self, api: Api, data: dict | None = None, device_id: str | None = None
):
) -> None:
"""Create a new instance of the DeviceEntity class."""
Entity.__init__(self, api)
Device.__init__(self)
Expand Down
2 changes: 1 addition & 1 deletion src/pysmartthings/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class Entity:
"""Define an entity from the SmartThings API."""

def __init__(self, api: Api):
def __init__(self, api: Api) -> None:
"""Initialize a new instance of the entity."""
self._api = api

Expand Down
2 changes: 1 addition & 1 deletion src/pysmartthings/installedapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class InstalledAppStatus(Enum):
class InstalledApp:
"""Define the InstalledApp class."""

def __init__(self):
def __init__(self) -> None:
"""Create a new instance of the InstalledApp class."""
self._installed_app_id = None
self._installed_app_type = InstalledAppType.UNKNOWN
Expand Down
4 changes: 2 additions & 2 deletions src/pysmartthings/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class Location:
"""Represents a SmartThings Location."""

def __init__(self):
def __init__(self) -> None:
"""Initialize a new location."""
self._name = None
self._location_id = None
Expand Down Expand Up @@ -89,7 +89,7 @@ class LocationEntity(Entity, Location):

def __init__(
self, api: Api, data: dict | None = None, location_id: str | None = None
):
) -> None:
"""Create a new instance of the LocationEntity."""
Entity.__init__(self, api)
Location.__init__(self)
Expand Down
2 changes: 1 addition & 1 deletion src/pysmartthings/oauthtoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class OAuthToken:

def __init__(
self, api: Api, data: dict | None = None, refresh_token: str | None = None
):
) -> None:
"""Create a new instance of the OAuthToken class."""
self._api = api
self._access_token = None
Expand Down
4 changes: 2 additions & 2 deletions src/pysmartthings/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class Room:
"""Defines a SmartThings room."""

def __init__(self):
def __init__(self) -> None:
"""Initialize the room."""
self._room_id = None
self._location_id = None
Expand Down Expand Up @@ -85,7 +85,7 @@ def __init__(
*,
location_id: str | None = None,
room_id: str | None = None,
):
) -> None:
"""Initialize the room."""
Entity.__init__(self, api)
Room.__init__(self)
Expand Down
4 changes: 2 additions & 2 deletions src/pysmartthings/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
class Scene:
"""Define a scene data entity."""

def __init__(self):
def __init__(self) -> None:
"""Create a new instance of the Scene class."""
self._color = None
self._icon = None
Expand Down Expand Up @@ -58,7 +58,7 @@ def scene_id(self) -> str:
class SceneEntity(Entity, Scene):
"""Define a scene entity."""

def __init__(self, api: Api, data: dict | None = None):
def __init__(self, api: Api, data: dict | None = None) -> None:
"""Create a new instance of the class."""
Entity.__init__(self, api)
Scene.__init__(self)
Expand Down
2 changes: 1 addition & 1 deletion src/pysmartthings/smartthings.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SmartThings:

__slots__ = ["_service"]

def __init__(self, session: ClientSession, token: str):
def __init__(self, session: ClientSession, token: str) -> None:
"""Initialize the SmartThingsApi."""
self._service = Api(session, token)

Expand Down
4 changes: 2 additions & 2 deletions src/pysmartthings/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SourceType(Enum):
class Subscription:
"""Define the subscription class."""

def __init__(self):
def __init__(self) -> None:
"""Initialize a new instance of the subscription class."""
self._subscription_id = None
self._installed_app_id = None
Expand Down Expand Up @@ -205,7 +205,7 @@ def component_id(self, value: str) -> None:
class SubscriptionEntity(Entity, Subscription):
"""Define a subscription entity."""

def __init__(self, api: Api, data: dict | None = None):
def __init__(self, api: Api, data: dict | None = None) -> None:
"""Create a new instance of the SubscriptionEntity class."""
Entity.__init__(self, api)
Subscription.__init__(self)
Expand Down
Loading