Skip to content

Commit

Permalink
Fix mypy nags in ritz.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Oct 13, 2023
1 parent 8794553 commit cca622b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/zinolib/ritz.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
from time import mktime
import re
from os.path import expanduser
from typing import NamedTuple
from typing import NamedTuple, List, Tuple, Union
import codecs
import select

Expand All @@ -108,7 +108,9 @@ class ProtocolError(Exception):


NotifierResponse = NamedTuple("NotifierResponse", [("id", int), ("type", str), ("info", str)])
DataResponse = NamedTuple("DataResponse", [("data", str), ("header", str)])
DataResponseData = Union[List[str], str]
DataResponseHeader = Union[Tuple[()], Tuple[int, str]]
DataResponse = NamedTuple("DataResponse", [("data", DataResponseData), ("header", DataResponseHeader)])


class caseState(enum.Enum):
Expand Down Expand Up @@ -377,9 +379,9 @@ def _request(self, command: bytes, recv_buffer=4096, **_):
"""
global logger
buffer = ""
data = True
header = False
r = []
data = b"DUMMY" # truthy, for mypy
header: DataResponseHeader = ()
r: List[str] = []
logger.debug("send: %s" % command.__repr__())
if command:
delimiter = bytes(self.DELIMITER, 'ascii')
Expand Down

0 comments on commit cca622b

Please sign in to comment.