Skip to content

Commit 17cf8d9

Browse files
committed
Rename action methods without verb
1 parent 7706acd commit 17cf8d9

File tree

11 files changed

+21
-20
lines changed

11 files changed

+21
-20
lines changed

aiohasupervisor/addons.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def restart_addon(self, addon: str) -> None:
5252
"""Restart an addon."""
5353
await self._client.post(f"addons/{addon}/restart")
5454

55-
async def addon_options(self, addon: str, options: AddonsOptions) -> None:
55+
async def set_addon_options(self, addon: str, options: AddonsOptions) -> None:
5656
"""Set options for addon."""
5757
await self._client.post(f"addons/{addon}/options", json=options.to_dict())
5858

@@ -78,11 +78,13 @@ async def rebuild_addon(self, addon: str) -> None:
7878
"""Rebuild an addon (only available for local addons built from source)."""
7979
await self._client.post(f"addons/{addon}/rebuild")
8080

81-
async def addon_stdin(self, addon: str, stdin: bytes) -> None:
81+
async def write_addon_stdin(self, addon: str, stdin: bytes) -> None:
8282
"""Write to stdin of an addon (if supported by addon)."""
8383
await self._client.post(f"addons/{addon}/stdin", data=stdin)
8484

85-
async def addon_security(self, addon: str, options: AddonsSecurityOptions) -> None:
85+
async def set_addon_security(
86+
self, addon: str, options: AddonsSecurityOptions
87+
) -> None:
8688
"""Set security options for addon."""
8789
await self._client.post(f"addons/{addon}/security", json=options.to_dict())
8890

@@ -91,9 +93,4 @@ async def addon_stats(self, addon: str) -> AddonsStats:
9193
result = await self._client.get(f"addons/{addon}/stats")
9294
return AddonsStats.from_dict(result.data)
9395

94-
# Aliases for clarity
95-
set_addon_options = addon_options
96-
write_addon_stdin = addon_stdin
97-
set_addon_security = addon_security
98-
9996
# Omitted for now - Log endpoints

aiohasupervisor/backups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def info(self) -> BackupsInfo:
3131
result = await self._client.get("backups/info")
3232
return BackupsInfo.from_dict(result.data)
3333

34-
async def options(self, options: BackupsOptions) -> None:
34+
async def set_options(self, options: BackupsOptions) -> None:
3535
"""Set options for backups."""
3636
await self._client.post("backups/options", json=options.to_dict())
3737

aiohasupervisor/homeassistant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async def stats(self) -> HomeAssistantStats:
2525
result = await self._client.get("core/stats")
2626
return HomeAssistantStats.from_dict(result.data)
2727

28-
async def options(self, options: HomeAssistantOptions) -> None:
28+
async def set_options(self, options: HomeAssistantOptions) -> None:
2929
"""Set Home Assistant options."""
3030
await self._client.post("core/options", json=options.to_dict())
3131

aiohasupervisor/host.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async def reload(self) -> None:
3535
"""Reload host info cache."""
3636
await self._client.post("host/reload")
3737

38-
async def options(self, options: HostOptions) -> None:
38+
async def set_options(self, options: HostOptions) -> None:
3939
"""Set host options."""
4040
await self._client.post("host/options", json=options.to_dict())
4141

aiohasupervisor/os.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def green_info(self) -> GreenInfo:
5555
result = await self._client.get("os/boards/green")
5656
return GreenInfo.from_dict(result.data)
5757

58-
async def green_options(self, options: GreenOptions) -> None:
58+
async def set_green_options(self, options: GreenOptions) -> None:
5959
"""Set options for green board (if in use)."""
6060
await self._client.post("os/boards/green", json=options.to_dict())
6161

@@ -64,6 +64,6 @@ async def yellow_info(self) -> YellowInfo:
6464
result = await self._client.get("os/boards/yellow")
6565
return YellowInfo.from_dict(result.data)
6666

67-
async def yellow_options(self, options: YellowOptions) -> None:
67+
async def set_yellow_options(self, options: YellowOptions) -> None:
6868
"""Set options for yellow board (if in use)."""
6969
await self._client.post("os/boards/yellow", json=options.to_dict())

aiohasupervisor/supervisor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def restart(self) -> None:
4646
"""Restart supervisor."""
4747
await self._client.post("supervisor/restart")
4848

49-
async def options(self, options: SupervisorOptions) -> None:
49+
async def set_options(self, options: SupervisorOptions) -> None:
5050
"""Set supervisor options."""
5151
await self._client.post("supervisor/options", json=options.to_dict())
5252

tests/test_backups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async def test_backups_options(
6060
"""Test backups options API."""
6161
responses.post(f"{SUPERVISOR_URL}/backups/options", status=200)
6262
assert (
63-
await supervisor_client.backups.options(BackupsOptions(days_until_stale=10))
63+
await supervisor_client.backups.set_options(BackupsOptions(days_until_stale=10))
6464
is None
6565
)
6666
assert responses.requests.keys() == {

tests/test_homeassistant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def test_homeassistant_options(
6161
"""Test Home Assistant options API."""
6262
responses.post(f"{SUPERVISOR_URL}/core/options", status=200)
6363
assert (
64-
await supervisor_client.homeassistant.options(
64+
await supervisor_client.homeassistant.set_options(
6565
HomeAssistantOptions(watchdog=False, backups_exclude_database=True)
6666
)
6767
is None

tests/test_host.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ async def test_host_options(
8787
) -> None:
8888
"""Test host options API."""
8989
responses.post(f"{SUPERVISOR_URL}/host/options", status=200)
90-
assert await supervisor_client.host.options(HostOptions(hostname="test")) is None
90+
assert (
91+
await supervisor_client.host.set_options(HostOptions(hostname="test")) is None
92+
)
9193
assert responses.requests.keys() == {
9294
("POST", URL(f"{SUPERVISOR_URL}/host/options"))
9395
}

tests/test_os.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ async def test_os_green_options(
141141
"""Test OS green board options API."""
142142
responses.post(f"{SUPERVISOR_URL}/os/boards/green", status=200)
143143
assert (
144-
await supervisor_client.os.green_options(GreenOptions(activity_led=False))
144+
await supervisor_client.os.set_green_options(GreenOptions(activity_led=False))
145145
is None
146146
)
147147
assert responses.requests.keys() == {
@@ -170,7 +170,9 @@ async def test_os_yellow_options(
170170
"""Test OS yellow board options API."""
171171
responses.post(f"{SUPERVISOR_URL}/os/boards/yellow", status=200)
172172
assert (
173-
await supervisor_client.os.yellow_options(YellowOptions(heartbeat_led=False))
173+
await supervisor_client.os.set_yellow_options(
174+
YellowOptions(heartbeat_led=False)
175+
)
174176
is None
175177
)
176178
assert responses.requests.keys() == {

0 commit comments

Comments
 (0)