Skip to content

Commit

Permalink
Fix new type error
Browse files Browse the repository at this point in the history
  • Loading branch information
Unrud committed Mar 5, 2023
1 parent 526d835 commit f8e28f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions radicale/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,16 @@


# IPv4 (host, port) and IPv6 (host, port, flowinfo, scopeid)
ADDRESS_TYPE = Union[Tuple[str, int], Tuple[str, int, int, int]]
ADDRESS_TYPE = Union[Tuple[Union[str, bytes, bytearray], int],
Tuple[str, int, int, int]]


def format_address(address: ADDRESS_TYPE) -> str:
return "[%s]:%d" % address[:2]
host, port, *_ = address
if not isinstance(host, str):
raise NotImplementedError("Unsupported address format: %r" %
(address,))
return "[%s]:%d" % (host, port)


class ParallelHTTPServer(socketserver.ThreadingMixIn,
Expand Down
4 changes: 2 additions & 2 deletions radicale/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ def get(self, path: str, check: Optional[int] = 200, **kwargs
status, _, answer = self.request("GET", path, check=check, **kwargs)
return status, answer

def post(self, path: str, data: str = None, check: Optional[int] = 200,
**kwargs) -> Tuple[int, str]:
def post(self, path: str, data: Optional[str] = None,
check: Optional[int] = 200, **kwargs) -> Tuple[int, str]:
status, _, answer = self.request("POST", path, data, check=check,
**kwargs)
return status, answer
Expand Down

0 comments on commit f8e28f6

Please sign in to comment.