Skip to content

Commit

Permalink
Explicitly derive from SubunitBase
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdwetering committed Jan 27, 2024
1 parent 0a2a079 commit 256e429
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 18 deletions.
5 changes: 3 additions & 2 deletions tests/test_mediaplayback_subunit_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from ynca import Playback, PlaybackInfo, Repeat, Shuffle
from ynca.subunits import MediaPlaybackSubunitBase
from ynca.subunits import MediaPlaybackMixins
from ynca.subunit import SubunitBase

SYS = "SYS"
SUBUNIT = "SUBUNIT"
Expand Down Expand Up @@ -46,7 +47,7 @@
]


class DummyMediaPlaybackSubunit(MediaPlaybackSubunitBase):
class DummyMediaPlaybackSubunit(MediaPlaybackMixins, SubunitBase):
id = "SUBUNIT"


Expand Down
3 changes: 1 addition & 2 deletions ynca/subunits/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@ class TrackFunctionMixin:

# A number of subunits have the same/similar featureset
# so make a common base that only needs to be tested once
class MediaPlaybackSubunitBase(
class MediaPlaybackMixins(
PlaybackFunctionMixin,
PlaybackInfoFunctionMixin,
RepeatFunctionMixin,
ShuffleFunctionMixin,
ArtistFunctionMixin,
AlbumFunctionMixin,
SongFunctionMixin,
SubunitBase,
):
pass

Expand Down
6 changes: 4 additions & 2 deletions ynca/subunits/ipod.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from __future__ import annotations


from ..constants import Subunit
from . import MediaPlaybackSubunitBase
from ..subunit import SubunitBase
from . import MediaPlaybackMixins


class Ipod(MediaPlaybackSubunitBase):
class Ipod(MediaPlaybackMixins, SubunitBase):
id = Subunit.IPOD
5 changes: 3 additions & 2 deletions ynca/subunits/ipodusb.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from ..constants import Subunit
from . import MediaPlaybackSubunitBase
from ..subunit import SubunitBase
from . import MediaPlaybackMixins


class IpodUsb(MediaPlaybackSubunitBase):
class IpodUsb(MediaPlaybackMixins, SubunitBase):
id = Subunit.IPODUSB
5 changes: 3 additions & 2 deletions ynca/subunits/napster.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from ..constants import Subunit
from . import MediaPlaybackSubunitBase
from ..subunit import SubunitBase
from . import MediaPlaybackMixins


class Napster(MediaPlaybackSubunitBase):
class Napster(MediaPlaybackMixins, SubunitBase):
id = Subunit.NAPSTER
5 changes: 3 additions & 2 deletions ynca/subunits/pc.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from ..constants import Subunit
from . import MediaPlaybackSubunitBase
from ..subunit import SubunitBase
from . import MediaPlaybackMixins


class Pc(MediaPlaybackSubunitBase):
class Pc(MediaPlaybackMixins, SubunitBase):
id = Subunit.PC
5 changes: 3 additions & 2 deletions ynca/subunits/rhap.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from ..constants import Subunit
from . import MediaPlaybackSubunitBase
from ..subunit import SubunitBase
from . import MediaPlaybackMixins


class Rhap(MediaPlaybackSubunitBase):
class Rhap(MediaPlaybackMixins, SubunitBase):
id = Subunit.RHAP
5 changes: 3 additions & 2 deletions ynca/subunits/server.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from ..constants import Subunit
from . import MediaPlaybackSubunitBase
from ..subunit import SubunitBase
from . import MediaPlaybackMixins


class Server(MediaPlaybackSubunitBase):
class Server(MediaPlaybackMixins, SubunitBase):
id = Subunit.SERVER
5 changes: 3 additions & 2 deletions ynca/subunits/usb.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

from ..constants import Subunit
from . import MediaPlaybackSubunitBase
from ..subunit import SubunitBase
from . import MediaPlaybackMixins


class Usb(MediaPlaybackSubunitBase):
class Usb(MediaPlaybackMixins, SubunitBase):
id = Subunit.USB

0 comments on commit 256e429

Please sign in to comment.