From 1e7fd270ebfb8ea6914d20b418cdcc157e82b9e2 Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Mon, 27 Nov 2023 15:48:52 +1100 Subject: [PATCH] Typehint the parts of python-mpd2 I'm using too --- stubs/mpd/asyncio.pyi | 23 +++++++++++++++++++++++ stubs/mpd/base.pyi | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 stubs/mpd/asyncio.pyi create mode 100644 stubs/mpd/base.pyi diff --git a/stubs/mpd/asyncio.pyi b/stubs/mpd/asyncio.pyi new file mode 100644 index 0000000..ea29554 --- /dev/null +++ b/stubs/mpd/asyncio.pyi @@ -0,0 +1,23 @@ +from collections.abc import AsyncIterator, Sequence +from typing import Literal + +from mpd.base import MPDClientBase +from mpd_now_playable.mpd import types + +class MPDClient(MPDClientBase): + mpd_version: str | None + + def __init__(self) -> None: ... + async def connect(self, host: str, port: int = ...) -> None: ... + async def password(self, password: str) -> None: ... + def idle(self, subsystems: Sequence[str] = ...) -> AsyncIterator[Sequence[str]]: ... + + async def status(self) -> types.StatusResponse: ... + async def currentsong(self) -> types.CurrentSongResponse: ... + async def readpicture(self, uri: str) -> types.ReadPictureResponse: ... + + async def play(self) -> None: ... + async def pause(self, pause: Literal[1, 0, None] = None) -> None: ... + async def stop(self) -> None: ... + async def next(self) -> None: ... # noqa: A003 + async def previous(self) -> None: ... diff --git a/stubs/mpd/base.pyi b/stubs/mpd/base.pyi new file mode 100644 index 0000000..44baf58 --- /dev/null +++ b/stubs/mpd/base.pyi @@ -0,0 +1,23 @@ +from enum import Enum + +class FailureResponseCode(Enum): + NOT_LIST: int + ARG: int + PASSWORD: int + PERMISSION: int + UNKNOWN: int + NO_EXIST: int + PLAYLIST_MAX: int + SYSTEM: int + PLAYLIST_LOAD: int + UPDATE_ALREADY: int + PLAYER_SYNC: int + EXIST: int + +class MPDError(Exception): ... + +class CommandError(MPDError): + pass + +class MPDClientBase: + pass