Skip to content

Commit

Permalink
ref(scope): Fix get_client typing
Browse files Browse the repository at this point in the history
The `Scope.get_client` method is typed as returning `sentry_sdk.client.BaseClient`, but because `sentry_sdk.client` was not imported, the type was resolved as `Any`. This change imports `sentry_sdk.client` to fix the type hints.
  • Loading branch information
szokeasaurusrex committed May 10, 2024
1 parent 2cdc635 commit bbe01a5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ class Scope(object):
"_propagation_context",
"client",
"_type",
"_last_event_id",
)

def __init__(self, ty=None, client=None):
Expand All @@ -207,6 +208,9 @@ def __init__(self, ty=None, client=None):
incoming_trace_information = self._load_trace_data_from_env()
self.generate_propagation_context(incoming_data=incoming_trace_information)

# self._last_event_id is only applicable to isolation scopes
self._last_event_id = None # type: Optional[str]

def __copy__(self):
# type: () -> Scope
"""
Expand Down Expand Up @@ -1640,3 +1644,6 @@ def should_send_default_pii():

# Circular imports
from sentry_sdk.client import NonRecordingClient

if TYPE_CHECKING:
import sentry_sdk.client

0 comments on commit bbe01a5

Please sign in to comment.