diff --git a/sentry_sdk/integrations/grpc/__init__.py b/sentry_sdk/integrations/grpc/__init__.py index 3d949091eb..d9dcdddb55 100644 --- a/sentry_sdk/integrations/grpc/__init__.py +++ b/sentry_sdk/integrations/grpc/__init__.py @@ -81,7 +81,7 @@ def _wrap_channel_async(func: Callable[P, AsyncChannel]) -> Callable[P, AsyncCha "Wrapper for asynchronous secure and insecure channel." @wraps(func) - def patched_channel( + def patched_channel( # type: ignore *args: P.args, interceptors: Optional[Sequence[grpc.aio.ClientInterceptor]] = None, **kwargs: P.kwargs, @@ -100,7 +100,7 @@ def _wrap_sync_server(func: Callable[P, Server]) -> Callable[P, Server]: """Wrapper for synchronous server.""" @wraps(func) - def patched_server( + def patched_server( # type: ignore *args: P.args, interceptors: Optional[Sequence[grpc.ServerInterceptor]] = None, **kwargs: P.kwargs, @@ -121,7 +121,7 @@ def _wrap_async_server(func: Callable[P, AsyncServer]) -> Callable[P, AsyncServe """Wrapper for asynchronous server.""" @wraps(func) - def patched_aio_server( + def patched_aio_server( # type: ignore *args: P.args, interceptors: Optional[Sequence[grpc.ServerInterceptor]] = None, **kwargs: P.kwargs, diff --git a/sentry_sdk/integrations/socket.py b/sentry_sdk/integrations/socket.py index 0866ceb608..babf61aa7a 100644 --- a/sentry_sdk/integrations/socket.py +++ b/sentry_sdk/integrations/socket.py @@ -27,15 +27,19 @@ def setup_once(): def _get_span_description(host, port): - # type: (Union[bytes, str, None], Union[str, int, None]) -> str + # type: (Union[bytes, str, None], Union[bytes, str, int, None]) -> str try: host = host.decode() # type: ignore except (UnicodeDecodeError, AttributeError): pass - description = "%s:%s" % (host, port) # type: ignore + try: + port = port.decode() # type: ignore + except (UnicodeDecodeError, AttributeError): + pass + description = "%s:%s" % (host, port) # type: ignore return description @@ -74,7 +78,7 @@ def _patch_getaddrinfo(): real_getaddrinfo = socket.getaddrinfo def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0): - # 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]]]] + # 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]]]] integration = sentry_sdk.get_client().get_integration(SocketIntegration) if integration is None: 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): return real_getaddrinfo(host, port, family, type, proto, flags) - socket.getaddrinfo = getaddrinfo # type: ignore + socket.getaddrinfo = getaddrinfo diff --git a/sentry_sdk/integrations/tornado.py b/sentry_sdk/integrations/tornado.py index b9e465c7c7..0f0f64d1a1 100644 --- a/sentry_sdk/integrations/tornado.py +++ b/sentry_sdk/integrations/tornado.py @@ -79,7 +79,7 @@ async def sentry_execute_request_handler(self, *args, **kwargs): else: @coroutine # type: ignore - def sentry_execute_request_handler(self, *args, **kwargs): + def sentry_execute_request_handler(self, *args, **kwargs): # type: ignore # type: (RequestHandler, *Any, **Any) -> Any with _handle_request_impl(self): result = yield from old_execute(self, *args, **kwargs)