From c353490d8fac7cb3f17193b1b2e3b9bb191d47ce Mon Sep 17 00:00:00 2001 From: Kaliko Jack Date: Sat, 1 Apr 2023 17:23:53 +0200 Subject: [PATCH] Remove Literal type hint (Need py >= 3.8) --- musicpd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/musicpd.py b/musicpd.py index f763a8e..e779355 100644 --- a/musicpd.py +++ b/musicpd.py @@ -13,7 +13,7 @@ import os 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 " @@ -418,7 +418,7 @@ class MPDClient: 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: @@ -439,7 +439,7 @@ class MPDClient: 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 @@ -448,7 +448,7 @@ class MPDClient: 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 -- 2.39.5