Skip to content

Commit 84fd6be

Browse files
Merge branch 'master' into sentry-sdk-2.0
2 parents cee64e0 + 9bdd029 commit 84fd6be

4 files changed

Lines changed: 54 additions & 18 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ lint: .venv
5151
apidocs: .venv
5252
@$(VENV_PATH)/bin/pip install --editable .
5353
@$(VENV_PATH)/bin/pip install -U -r ./docs-requirements.txt
54+
rm -rf docs/_build
5455
@$(VENV_PATH)/bin/sphinx-build -vv -W -b html docs/ docs/_build
5556
.PHONY: apidocs
5657

sentry_sdk/scope.py

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -712,13 +712,28 @@ def clear(self):
712712

713713
@_attr_setter
714714
def level(self, value):
715-
# type: (Optional[LogLevelStr]) -> None
716-
"""When set this overrides the level. Deprecated in favor of set_level."""
715+
# type: (LogLevelStr) -> None
716+
"""
717+
When set this overrides the level.
718+
719+
.. deprecated:: 1.0.0
720+
Use :func:`set_level` instead.
721+
722+
:param value: The level to set.
723+
"""
724+
logger.warning(
725+
"Deprecated: use .set_level() instead. This will be removed in the future."
726+
)
727+
717728
self._level = value
718729

719730
def set_level(self, value):
720-
# type: (Optional[LogLevelStr]) -> None
721-
"""Sets the level for the scope."""
731+
# type: (LogLevelStr) -> None
732+
"""
733+
Sets the level for the scope.
734+
735+
:param value: The level to set.
736+
"""
722737
self._level = value
723738

724739
@_attr_setter
@@ -827,20 +842,24 @@ def profile(self, profile):
827842

828843
self._profile = profile
829844

830-
def set_tag(
831-
self,
832-
key, # type: str
833-
value, # type: Any
834-
):
835-
# type: (...) -> None
836-
"""Sets a tag for a key to a specific value."""
845+
def set_tag(self, key, value):
846+
# type: (str, Any) -> None
847+
"""
848+
Sets a tag for a key to a specific value.
849+
850+
:param key: Key of the tag to set.
851+
852+
:param value: Value of the tag to set.
853+
"""
837854
self._tags[key] = value
838855

839-
def remove_tag(
840-
self, key # type: str
841-
):
842-
# type: (...) -> None
843-
"""Removes a specific tag."""
856+
def remove_tag(self, key):
857+
# type: (str) -> None
858+
"""
859+
Removes a specific tag.
860+
861+
:param key: Key of the tag to remove.
862+
"""
844863
self._tags.pop(key, None)
845864

846865
def set_context(
@@ -849,7 +868,9 @@ def set_context(
849868
value, # type: Dict[str, Any]
850869
):
851870
# type: (...) -> None
852-
"""Binds a context at a certain key to a specific value."""
871+
"""
872+
Binds a context at a certain key to a specific value.
873+
"""
853874
self._contexts[key] = value
854875

855876
def remove_context(

sentry_sdk/types.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""
2+
This module contains type definitions for the Sentry SDK's public API.
3+
The types are re-exported from the internal module `sentry_sdk._types`.
4+
5+
Disclaimer: Since types are a form of documentation, type definitions
6+
may change in minor releases. Removing a type would be considered a
7+
breaking change, and so we will only remove type definitions in major
8+
releases.
9+
"""
10+
11+
from typing import TYPE_CHECKING
12+
13+
if TYPE_CHECKING:
14+
from sentry_sdk._types import Event, Hint # noqa: F401

tests/integrations/openai/test_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_streaming_chat_completion(
9999
events = capture_events()
100100

101101
client = OpenAI(api_key="z")
102-
returned_stream = Stream(cast_to=None, response=None, client=None)
102+
returned_stream = Stream(cast_to=None, response=None, client=client)
103103
returned_stream._iterator = [
104104
ChatCompletionChunk(
105105
id="1",

0 commit comments

Comments
 (0)