]> kaliko git repositories - python-musicpdaio.git/blobdiff - mpdaio/client.py
Fixed unused argument
[python-musicpdaio.git] / mpdaio / client.py
index aaffc0a929e3f4b9cc7de56ce3d95c4d9c1fd480..2b971627e6d604dcd4046f524eb979c1d0cb34b2 100644 (file)
@@ -37,8 +37,8 @@ class MPDClient:
     """
 
     def __init__(self, host: str | None = None,
-            port: str | int | None = None,
-            password: str | None = None):
+                 port: str | int | None = None,
+                 password: str | None = None):
         #: Connection pool
         self._pool = ConnectionPool(max_connections=CONNECTION_MAX)
         #: connection timeout
@@ -267,7 +267,7 @@ class CmdHandler:
             "sendmessage":        self._fetch_nothing,
         }
         self.command = None
-        self._command_list = None
+        self._command_list: list | None = None
         self.args = None
         self.pool = pool
         self.host = (server, port)
@@ -347,7 +347,7 @@ class CmdHandler:
             amount -= len(result)
         return bytes(chunk)
 
-    async def _read_line(self, binary=False):
+    async def _read_line(self):
         line = await self.connection.readline()
         line = line.decode('utf-8')
         if not line.endswith('\n'):
@@ -366,8 +366,8 @@ class CmdHandler:
             return None
         return line
 
-    async def _read_pair(self, separator, binary=False):
-        line = await self._read_line(binary=binary)
+    async def _read_pair(self, separator):
+        line = await self._read_line()
         if line is None:
             return None
         pair = line.split(separator, 1)
@@ -375,11 +375,11 @@ class CmdHandler:
             raise MPDProtocolError(f"Could not parse pair: '{line}'")
         return pair
 
-    async def _read_pairs(self, separator=": ", binary=False):
-        pair = await self._read_pair(separator, binary=binary)
+    async def _read_pairs(self, separator=": "):
+        pair = await self._read_pair(separator)
         while pair:
             yield pair
-            pair = await self._read_pair(separator, binary=binary)
+            pair = await self._read_pair(separator)
 
     async def _read_list(self):
         seen = None
@@ -426,7 +426,7 @@ class CmdHandler:
     async def _fetch_nothing(self):
         line = await self._read_line()
         if line is not None:
-            raise ProtocolError(f"Got unexpected return value: '{line}'")
+            raise MPDProtocolError(f"Got unexpected return value: '{line}'")
 
     async def _fetch_item(self):
         pairs = [_ async for _ in self._read_pairs()]
@@ -478,7 +478,7 @@ class CmdHandler:
 
     async def _fetch_composite(self):
         obj = {}
-        async for key, value in self._read_pairs(binary=True):
+        async for key, value in self._read_pairs():
             key = key.lower()
             obj[key] = value
             if key == 'binary':
@@ -498,10 +498,10 @@ class CmdHandler:
             raise ConnectionError('Error reading binary content: '
                                   f'Expects {amount}B, got {data_bytes}')
         # Fetches trailing new line
-        await self._read_line(binary=True)
+        await self._read_line()
         #ALT: await self.connection.readuntil(b'\n')
         # Fetches SUCCESS code
-        await self._read_line(binary=True)
+        await self._read_line()
         #ALT: await self.connection.readuntil(b'OK\n')
         return obj