Skip to content

Commit 1fd2b86

Browse files
authored
Fix mypy (#4019)
mypy is unhappy in CI, fix it.
1 parent 797e82f commit 1fd2b86

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

sentry_sdk/integrations/grpc/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def _wrap_channel_async(func: Callable[P, AsyncChannel]) -> Callable[P, AsyncCha
8181
"Wrapper for asynchronous secure and insecure channel."
8282

8383
@wraps(func)
84-
def patched_channel(
84+
def patched_channel( # type: ignore
8585
*args: P.args,
8686
interceptors: Optional[Sequence[grpc.aio.ClientInterceptor]] = None,
8787
**kwargs: P.kwargs,
@@ -100,7 +100,7 @@ def _wrap_sync_server(func: Callable[P, Server]) -> Callable[P, Server]:
100100
"""Wrapper for synchronous server."""
101101

102102
@wraps(func)
103-
def patched_server(
103+
def patched_server( # type: ignore
104104
*args: P.args,
105105
interceptors: Optional[Sequence[grpc.ServerInterceptor]] = None,
106106
**kwargs: P.kwargs,
@@ -121,7 +121,7 @@ def _wrap_async_server(func: Callable[P, AsyncServer]) -> Callable[P, AsyncServe
121121
"""Wrapper for asynchronous server."""
122122

123123
@wraps(func)
124-
def patched_aio_server(
124+
def patched_aio_server( # type: ignore
125125
*args: P.args,
126126
interceptors: Optional[Sequence[grpc.ServerInterceptor]] = None,
127127
**kwargs: P.kwargs,

sentry_sdk/integrations/socket.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ def setup_once():
2727

2828

2929
def _get_span_description(host, port):
30-
# type: (Union[bytes, str, None], Union[str, int, None]) -> str
30+
# type: (Union[bytes, str, None], Union[bytes, str, int, None]) -> str
3131

3232
try:
3333
host = host.decode() # type: ignore
3434
except (UnicodeDecodeError, AttributeError):
3535
pass
3636

37-
description = "%s:%s" % (host, port) # type: ignore
37+
try:
38+
port = port.decode() # type: ignore
39+
except (UnicodeDecodeError, AttributeError):
40+
pass
3841

42+
description = "%s:%s" % (host, port) # type: ignore
3943
return description
4044

4145

@@ -74,7 +78,7 @@ def _patch_getaddrinfo():
7478
real_getaddrinfo = socket.getaddrinfo
7579

7680
def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
77-
# type: (Union[bytes, str, None], Union[str, int, None], int, int, int, int) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int]]]]
81+
# type: (Union[bytes, str, None], Union[bytes, str, int, None], int, int, int, int) -> List[Tuple[AddressFamily, SocketKind, int, str, Union[Tuple[str, int], Tuple[str, int, int, int], Tuple[int, bytes]]]]
7882
integration = sentry_sdk.get_client().get_integration(SocketIntegration)
7983
if integration is None:
8084
return real_getaddrinfo(host, port, family, type, proto, flags)
@@ -89,4 +93,4 @@ def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0):
8993

9094
return real_getaddrinfo(host, port, family, type, proto, flags)
9195

92-
socket.getaddrinfo = getaddrinfo # type: ignore
96+
socket.getaddrinfo = getaddrinfo

sentry_sdk/integrations/tornado.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ async def sentry_execute_request_handler(self, *args, **kwargs):
7979
else:
8080

8181
@coroutine # type: ignore
82-
def sentry_execute_request_handler(self, *args, **kwargs):
82+
def sentry_execute_request_handler(self, *args, **kwargs): # type: ignore
8383
# type: (RequestHandler, *Any, **Any) -> Any
8484
with _handle_request_impl(self):
8585
result = yield from old_execute(self, *args, **kwargs)

0 commit comments

Comments
 (0)