Skip to content

Commit e715e18

Browse files
committed
fix: Better signatures for contextmanagers
1 parent 7413329 commit e715e18

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

sentry_sdk/api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from typing import Optional
1111
from typing import overload
1212
from typing import Callable
13-
from contextlib import AbstractContextManager
13+
from contextlib import ContextManager
1414
else:
1515

1616
def overload(x):
@@ -67,13 +67,13 @@ def add_breadcrumb(*args, **kwargs):
6767

6868
@overload # noqa
6969
def configure_scope():
70-
# type: () -> AbstractContextManager
70+
# type: () -> ContextManager[Scope]
7171
pass
7272

7373

7474
@overload # noqa
7575
def configure_scope(callback):
76-
# type: (Callable) -> None
76+
# type: (Callable[[Scope], None]) -> None
7777
pass
7878

7979

@@ -96,13 +96,13 @@ def inner():
9696

9797
@overload # noqa
9898
def push_scope():
99-
# type: () -> AbstractContextManager
99+
# type: () -> ContextManager[Scope]
100100
pass
101101

102102

103103
@overload # noqa
104104
def push_scope(callback):
105-
# type: (Callable) -> None
105+
# type: (Callable[[Scope], None]) -> None
106106
pass
107107

108108

sentry_sdk/consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"attach_stacktrace": bool,
3939
"ca_certs": Optional[str],
4040
},
41+
total=False,
4142
)
4243

4344

sentry_sdk/hub.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from typing import List
2626
from typing import Callable
2727
from typing import overload
28-
from contextlib import AbstractContextManager
28+
from contextlib import ContextManager
2929
from sentry_sdk.integrations import Integration
3030
else:
3131

@@ -342,12 +342,12 @@ def add_breadcrumb(self, crumb=None, hint=None, **kwargs):
342342

343343
@overload # noqa
344344
def push_scope(self):
345-
# type: () -> AbstractContextManager
345+
# type: () -> ContextManager[Scope]
346346
pass
347347

348348
@overload # noqa
349349
def push_scope(self, callback):
350-
# type: (Callable) -> None
350+
# type: (Callable[[Scope], None]) -> None
351351
pass
352352

353353
def push_scope(self, callback=None): # noqa
@@ -378,12 +378,12 @@ def pop_scope_unsafe(self):
378378

379379
@overload # noqa
380380
def configure_scope(self):
381-
# type: () -> AbstractContextManager
381+
# type: () -> ContextManager[Scope]
382382
pass
383383

384384
@overload # noqa
385385
def configure_scope(self, callback):
386-
# type: (Callable) -> None
386+
# type: (Callable[[Scope], None]) -> None
387387
pass
388388

389389
def configure_scope(self, callback=None): # noqa

0 commit comments

Comments
 (0)