88
99# TODO-neel-potel make 2 scope strategies/impls and switch
1010from sentry_sdk .scope import Scope as BaseScope
11- from sentry_sdk .integrations . opentelemetry .scope import (
11+ from sentry_sdk .opentelemetry .scope import (
1212 PotelScope as Scope ,
1313 new_scope ,
1414 isolation_scope ,
3030 from typing import Union
3131 from typing import Generator
3232
33- from sentry_sdk .client import BaseClient
34- from sentry_sdk ._types import (
35- Event ,
36- Hint ,
37- Breadcrumb ,
38- BreadcrumbHint ,
39- ExcInfo ,
40- MeasurementUnit ,
41- LogLevelStr ,
42- )
43- from sentry_sdk .tracing import Span
33+ import sentry_sdk
4434
4535 T = TypeVar ("T" )
4636 F = TypeVar ("F" , bound = Callable [..., Any ])
@@ -102,7 +92,7 @@ def clientmethod(f):
10292
10393@scopemethod
10494def get_client ():
105- # type: () -> BaseClient
95+ # type: () -> sentry_sdk.client. BaseClient
10696 return Scope .get_client ()
10797
10898
@@ -150,8 +140,8 @@ def last_event_id():
150140
151141@scopemethod
152142def capture_event (
153- event , # type: Event
154- hint = None , # type: Optional[Hint]
143+ event , # type: sentry_sdk._types. Event
144+ hint = None , # type: Optional[sentry_sdk._types. Hint]
155145 scope = None , # type: Optional[Any]
156146 ** scope_kwargs , # type: Any
157147):
@@ -162,7 +152,7 @@ def capture_event(
162152@scopemethod
163153def capture_message (
164154 message , # type: str
165- level = None , # type: Optional[LogLevelStr]
155+ level = None , # type: Optional[sentry_sdk._types. LogLevelStr]
166156 scope = None , # type: Optional[Any]
167157 ** scope_kwargs , # type: Any
168158):
@@ -174,7 +164,7 @@ def capture_message(
174164
175165@scopemethod
176166def capture_exception (
177- error = None , # type: Optional[Union[BaseException, ExcInfo]]
167+ error = None , # type: Optional[Union[BaseException, sentry_sdk._types. ExcInfo]]
178168 scope = None , # type: Optional[Any]
179169 ** scope_kwargs , # type: Any
180170):
@@ -184,8 +174,8 @@ def capture_exception(
184174
185175@scopemethod
186176def add_breadcrumb (
187- crumb = None , # type: Optional[Breadcrumb]
188- hint = None , # type: Optional[BreadcrumbHint]
177+ crumb = None , # type: Optional[sentry_sdk._types. Breadcrumb]
178+ hint = None , # type: Optional[sentry_sdk._types. BreadcrumbHint]
189179 ** kwargs , # type: Any
190180):
191181 # type: (...) -> None
@@ -224,7 +214,7 @@ def set_user(value):
224214
225215@scopemethod
226216def set_level (value ):
227- # type: (LogLevelStr) -> None
217+ # type: (sentry_sdk._types. LogLevelStr) -> None
228218 return get_isolation_scope ().set_level (value )
229219
230220
@@ -238,7 +228,7 @@ def flush(
238228
239229
240230def start_span (** kwargs ):
241- # type: (Any) -> Span
231+ # type: (Any) -> sentry_sdk.tracing. Span
242232 """
243233 Start and return a span.
244234
@@ -255,10 +245,10 @@ def start_span(**kwargs):
255245
256246
257247def start_transaction (
258- transaction = None , # type: Optional[Span]
248+ transaction = None , # type: Optional[sentry_sdk.tracing. Span]
259249 ** kwargs , # type: Any
260250):
261- # type: (...) -> Span
251+ # type: (...) -> sentry_sdk.tracing. Span
262252 """
263253 .. deprecated:: 3.0.0
264254 This function is deprecated and will be removed in a future release.
@@ -298,14 +288,14 @@ def start_transaction(
298288
299289
300290def set_measurement (name , value , unit = "" ):
301- # type: (str, float, MeasurementUnit) -> None
291+ # type: (str, float, sentry_sdk._types. MeasurementUnit) -> None
302292 transaction = get_current_scope ().root_span
303293 if transaction is not None :
304294 transaction .set_measurement (name , value , unit )
305295
306296
307297def get_current_span (scope = None ):
308- # type: (Optional[Scope]) -> Optional[Span]
298+ # type: (Optional[Scope]) -> Optional[sentry_sdk.tracing. Span]
309299 """
310300 Returns the currently active span if there is one running, otherwise `None`
311301 """
0 commit comments