Skip to content

Commit

Permalink
Merge branch 'master' into sentry-sdk-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
szokeasaurusrex committed Mar 18, 2024
2 parents cee64e0 + 9bdd029 commit 84fd6be
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 18 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ lint: .venv
apidocs: .venv
@$(VENV_PATH)/bin/pip install --editable .
@$(VENV_PATH)/bin/pip install -U -r ./docs-requirements.txt
rm -rf docs/_build
@$(VENV_PATH)/bin/sphinx-build -vv -W -b html docs/ docs/_build
.PHONY: apidocs

Expand Down
55 changes: 38 additions & 17 deletions sentry_sdk/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,28 @@ def clear(self):

@_attr_setter
def level(self, value):
# type: (Optional[LogLevelStr]) -> None
"""When set this overrides the level. Deprecated in favor of set_level."""
# type: (LogLevelStr) -> None
"""
When set this overrides the level.
.. deprecated:: 1.0.0
Use :func:`set_level` instead.
:param value: The level to set.
"""
logger.warning(
"Deprecated: use .set_level() instead. This will be removed in the future."
)

self._level = value

def set_level(self, value):
# type: (Optional[LogLevelStr]) -> None
"""Sets the level for the scope."""
# type: (LogLevelStr) -> None
"""
Sets the level for the scope.
:param value: The level to set.
"""
self._level = value

@_attr_setter
Expand Down Expand Up @@ -827,20 +842,24 @@ def profile(self, profile):

self._profile = profile

def set_tag(
self,
key, # type: str
value, # type: Any
):
# type: (...) -> None
"""Sets a tag for a key to a specific value."""
def set_tag(self, key, value):
# type: (str, Any) -> None
"""
Sets a tag for a key to a specific value.
:param key: Key of the tag to set.
:param value: Value of the tag to set.
"""
self._tags[key] = value

def remove_tag(
self, key # type: str
):
# type: (...) -> None
"""Removes a specific tag."""
def remove_tag(self, key):
# type: (str) -> None
"""
Removes a specific tag.
:param key: Key of the tag to remove.
"""
self._tags.pop(key, None)

def set_context(
Expand All @@ -849,7 +868,9 @@ def set_context(
value, # type: Dict[str, Any]
):
# type: (...) -> None
"""Binds a context at a certain key to a specific value."""
"""
Binds a context at a certain key to a specific value.
"""
self._contexts[key] = value

def remove_context(
Expand Down
14 changes: 14 additions & 0 deletions sentry_sdk/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""
This module contains type definitions for the Sentry SDK's public API.
The types are re-exported from the internal module `sentry_sdk._types`.
Disclaimer: Since types are a form of documentation, type definitions
may change in minor releases. Removing a type would be considered a
breaking change, and so we will only remove type definitions in major
releases.
"""

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from sentry_sdk._types import Event, Hint # noqa: F401
2 changes: 1 addition & 1 deletion tests/integrations/openai/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_streaming_chat_completion(
events = capture_events()

client = OpenAI(api_key="z")
returned_stream = Stream(cast_to=None, response=None, client=None)
returned_stream = Stream(cast_to=None, response=None, client=client)
returned_stream._iterator = [
ChatCompletionChunk(
id="1",
Expand Down

0 comments on commit 84fd6be

Please sign in to comment.