from functools import wraps
# Type hint for python <= 3.8
from typing import Any, Dict, List, Tuple
-from typing import Literal, Optional, Union
+from typing import Optional, Union
HELLO_PREFIX = "OK MPD "
ERROR_PREFIX = "ACK "
amount -= len(result)
return bytes(chunk)
- def _read_line(self, binary: Literal[True,False] = False):
+ def _read_line(self, binary: bool = False):
if binary:
line = self._rbfile.readline().decode('utf-8')
else:
return None
return line
- def _read_pair(self, separator: str, binary: Literal[True,False] = False):
+ def _read_pair(self, separator: str, binary: bool = False):
line = self._read_line(binary=binary)
if line is None:
return None
raise ProtocolError(f"Could not parse pair: '{line}'")
return pair
- def _read_pairs(self, separator=": ", binary: Literal[True,False] =False):
+ def _read_pairs(self, separator=": ", binary: bool =False):
pair = self._read_pair(separator, binary=binary)
while pair:
yield pair