From 627282eb58cd0e66c40b08d21369a2b8f9a3662b Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 15 Mar 2024 15:40:11 +0100 Subject: [PATCH 1/3] Make sure all apidocs are recreated always --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 32cdbb1fff..ac0ef51f5f 100644 --- a/Makefile +++ b/Makefile @@ -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 From f1a6c1364711ac7f30fc597a4a01fb909b296544 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Fri, 15 Mar 2024 15:40:22 +0100 Subject: [PATCH 2/3] Added level apidocs --- sentry_sdk/scope.py | 48 +++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 80537cd8bf..61de722e62 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -441,13 +441,21 @@ 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 in favor of set_level. + + :param value: The level to set. + """ 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 @@ -555,20 +563,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( @@ -577,7 +589,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( From 3b9c12b7e087db11772d46ff6b680805c788af7b Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Mon, 18 Mar 2024 10:10:12 +0100 Subject: [PATCH 3/3] Added deprecation warning --- sentry_sdk/scope.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/scope.py b/sentry_sdk/scope.py index 61de722e62..cd974e4a52 100644 --- a/sentry_sdk/scope.py +++ b/sentry_sdk/scope.py @@ -443,10 +443,17 @@ def clear(self): def level(self, value): # type: (LogLevelStr) -> None """ - When set this overrides the level. Deprecated in favor of set_level. + 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):