Skip to content

Commit 3c52872

Browse files
committed
make apidocs happy
1 parent 33709ef commit 3c52872

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

sentry_sdk/_init_implementation.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
from typing import TYPE_CHECKING
22

33
import sentry_sdk
4+
from sentry_sdk.consts import ClientConstructor
45
from sentry_sdk.integrations.opentelemetry.scope import setup_scope_context_management
56

67
if TYPE_CHECKING:
78
from typing import Any, Optional
89

9-
import sentry_sdk.consts
10-
1110

1211
def _check_python_deprecations():
1312
# type: () -> None
@@ -36,7 +35,7 @@ def _init(*args, **kwargs):
3635
# Use `ClientConstructor` to define the argument types of `init` and
3736
# `ContextManager[Any]` to tell static analyzers about the return type.
3837

39-
class init(sentry_sdk.consts.ClientConstructor): # noqa: N801
38+
class init(ClientConstructor): # noqa: N801
4039
pass
4140

4241
else:

sentry_sdk/api.py

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,7 @@
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
10494
def 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
152142
def 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
163153
def 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
176166
def 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
186176
def 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
226216
def 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

240230
def 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

257247
def 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

300290
def 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().transaction
303293
if transaction is not None:
304294
transaction.set_measurement(name, value, unit)
305295

306296

307297
def 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

Comments
 (0)