54
54
Union ,
55
55
)
56
56
57
+ from gevent .hub import Hub
58
+
57
59
import sentry_sdk .integrations
58
60
from sentry_sdk ._types import Event , ExcInfo
59
61
@@ -1182,8 +1184,8 @@ def _is_contextvars_broken():
1182
1184
Returns whether gevent/eventlet have patched the stdlib in a way where thread locals are now more "correct" than contextvars.
1183
1185
"""
1184
1186
try :
1185
- import gevent # type: ignore
1186
- from gevent .monkey import is_object_patched # type: ignore
1187
+ import gevent
1188
+ from gevent .monkey import is_object_patched
1187
1189
1188
1190
# Get the MAJOR and MINOR version numbers of Gevent
1189
1191
version_tuple = tuple (
@@ -1209,7 +1211,7 @@ def _is_contextvars_broken():
1209
1211
pass
1210
1212
1211
1213
try :
1212
- import greenlet # type: ignore
1214
+ import greenlet
1213
1215
from eventlet .patcher import is_monkey_patched # type: ignore
1214
1216
1215
1217
greenlet_version = parse_version (greenlet .__version__ )
@@ -1794,12 +1796,14 @@ def now():
1794
1796
from gevent .monkey import is_module_patched
1795
1797
except ImportError :
1796
1798
1797
- def get_gevent_hub ():
1798
- # type: () -> Any
1799
+ # it's not great that the signatures are different, get_hub can't return None
1800
+ # consider adding an if TYPE_CHECKING to change the signature to Optional[Hub]
1801
+ def get_gevent_hub (): # type: ignore[misc]
1802
+ # type: () -> Optional[Hub]
1799
1803
return None
1800
1804
1801
- def is_module_patched (* args , ** kwargs ):
1802
- # type: (*Any, **Any ) -> bool
1805
+ def is_module_patched (mod_name ):
1806
+ # type: (str ) -> bool
1803
1807
# unable to import from gevent means no modules have been patched
1804
1808
return False
1805
1809
0 commit comments