Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelveldt committed Aug 26, 2024
1 parent 7080d7f commit e3fca48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 3 additions & 9 deletions aiosonos/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ def __init__(self, client: SonosLocalApiClient, data: GroupData) -> None:
positionMillis=0,
previousPositionMillis=0,
)
self._playback_metadata_data: MetadataStatus = MetadataStatus(
objectType="metadataStatus"
)
self._playback_metadata_data: MetadataStatus = MetadataStatus(objectType="metadataStatus")
self._playback_status_last_updated: float = 0.0
self._unsubscribe_callbacks = []

Expand All @@ -87,9 +85,7 @@ async def async_init(self) -> None:
# grab playback data and setup subscription
try:
self._volume_data = await self.client.api.group_volume.get_volume(self.id)
self._playback_status_data = (
await self.client.api.playback.get_playback_status(self.id)
)
self._playback_status_data = await self.client.api.playback.get_playback_status(self.id)
self._playback_status_last_updated = time.time()
self._playback_actions = PlaybackActions(
self._playback_status_data["availablePlaybackActions"],
Expand Down Expand Up @@ -214,9 +210,7 @@ def active_service(self) -> MusicService | None:
"""Return the active service of the active source of this group (if any)."""
if not (container := self._playback_metadata_data.get("container")):
return None
if (container_id := container.get("id")) and (
service_id := container_id.get("serviceId")
):
if (container_id := container.get("id")) and (service_id := container_id.get("serviceId")):
if service_id in MusicService:
return MusicService(service_id)
# return the raw string value if it's not a known container type
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ ignore = [
"S101", # assert is often used to satisfy type checking
"TD002", # Just annoying, not really useful
"TD003", # Just annoying, not really useful
"TD004", # Just annoying, not really useful # Conflicts with the Ruff formatter
"TD004", # Just annoying, not really useful
"TRY003", # Just annoying, not really useful
"COM812", # Conflicts with the Ruff formatter
"ISC001", # Conflicts with the Ruff formatter
]

select = ["ALL"]
Expand Down

0 comments on commit e3fca48

Please sign in to comment.