Skip to content

Commit 7bfc6a0

Browse files
committed
Missing files
1 parent 16bbe44 commit 7bfc6a0

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

sentry_sdk/api.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,11 @@ def continue_trace(environ_or_headers: dict[str, Any]) -> Generator[None, None,
317317

318318
@scopemethod
319319
def start_session(
320-
session_mode="application", # type: str
321-
):
322-
# type: (...) -> None
320+
session_mode: str = "application",
321+
) -> None:
323322
return get_isolation_scope().start_session(session_mode=session_mode)
324323

325324

326325
@scopemethod
327-
def end_session():
328-
# type: () -> None
326+
def end_session() -> None:
329327
return get_isolation_scope().end_session()

sentry_sdk/integrations/grpc/aio/server.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import annotations
12
import sentry_sdk
23
from sentry_sdk.consts import OP
34
from sentry_sdk.integrations import DidNotEnable
@@ -21,14 +22,19 @@
2122

2223

2324
class ServerInterceptor(grpc.aio.ServerInterceptor): # type: ignore
24-
def __init__(self, find_name=None):
25-
# type: (ServerInterceptor, Callable[[ServicerContext], str] | None) -> None
25+
def __init__(
26+
self: ServerInterceptor,
27+
find_name: Callable[[ServicerContext], str] | None = None,
28+
) -> None:
2629
self._find_method_name = find_name or self._find_name
2730

2831
super().__init__()
2932

30-
async def intercept_service(self, continuation, handler_call_details):
31-
# type: (ServerInterceptor, Callable[[HandlerCallDetails], Awaitable[RpcMethodHandler]], HandlerCallDetails) -> Optional[Awaitable[RpcMethodHandler]]
33+
async def intercept_service(
34+
self: ServerInterceptor,
35+
continuation: Callable[[HandlerCallDetails], Awaitable[RpcMethodHandler]],
36+
handler_call_details: HandlerCallDetails,
37+
) -> Optional[Awaitable[RpcMethodHandler]]:
3238
self._handler_call_details = handler_call_details
3339
handler = await continuation(handler_call_details)
3440
if handler is None:
@@ -37,8 +43,7 @@ async def intercept_service(self, continuation, handler_call_details):
3743
if not handler.request_streaming and not handler.response_streaming:
3844
handler_factory = grpc.unary_unary_rpc_method_handler
3945

40-
async def wrapped(request, context):
41-
# type: (Any, ServicerContext) -> Any
46+
async def wrapped(request: Any, context: ServicerContext) -> Any:
4247
name = self._find_method_name(context)
4348
if not name:
4449
return await handler(request, context)
@@ -66,24 +71,21 @@ async def wrapped(request, context):
6671
elif not handler.request_streaming and handler.response_streaming:
6772
handler_factory = grpc.unary_stream_rpc_method_handler
6873

69-
async def wrapped(request, context): # type: ignore
70-
# type: (Any, ServicerContext) -> Any
74+
async def wrapped(request: Any, context: ServicerContext) -> Any: # type: ignore
7175
async for r in handler.unary_stream(request, context):
7276
yield r
7377

7478
elif handler.request_streaming and not handler.response_streaming:
7579
handler_factory = grpc.stream_unary_rpc_method_handler
7680

77-
async def wrapped(request, context):
78-
# type: (Any, ServicerContext) -> Any
81+
async def wrapped(request: Any, context: ServicerContext) -> Any:
7982
response = handler.stream_unary(request, context)
8083
return await response
8184

8285
elif handler.request_streaming and handler.response_streaming:
8386
handler_factory = grpc.stream_stream_rpc_method_handler
8487

85-
async def wrapped(request, context): # type: ignore
86-
# type: (Any, ServicerContext) -> Any
88+
async def wrapped(request: Any, context: ServicerContext) -> Any: # type: ignore
8789
async for r in handler.stream_stream(request, context):
8890
yield r
8991

@@ -93,6 +95,5 @@ async def wrapped(request, context): # type: ignore
9395
response_serializer=handler.response_serializer,
9496
)
9597

96-
def _find_name(self, context):
97-
# type: (ServicerContext) -> str
98+
def _find_name(self, context: ServicerContext) -> str:
9899
return self._handler_call_details.method

0 commit comments

Comments
 (0)