Skip to content

Commit 9bdd029

Browse files
authored
Small APIdocs improvement (#2828)
This PR makes sure all apidocs are recreated always (by deleting an eventually existing docs/_build folder) and also adds some minor changes to set_level and set_tag to make the types of parameters clear.
1 parent 9dc517b commit 9bdd029

File tree

2 files changed

+39
-17
lines changed

2 files changed

+39
-17
lines changed

Makefile

+1
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

+38-17
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,28 @@ def clear(self):
441441

442442
@_attr_setter
443443
def level(self, value):
444-
# type: (Optional[LogLevelStr]) -> None
445-
"""When set this overrides the level. Deprecated in favor of set_level."""
444+
# type: (LogLevelStr) -> None
445+
"""
446+
When set this overrides the level.
447+
448+
.. deprecated:: 1.0.0
449+
Use :func:`set_level` instead.
450+
451+
:param value: The level to set.
452+
"""
453+
logger.warning(
454+
"Deprecated: use .set_level() instead. This will be removed in the future."
455+
)
456+
446457
self._level = value
447458

448459
def set_level(self, value):
449-
# type: (Optional[LogLevelStr]) -> None
450-
"""Sets the level for the scope."""
460+
# type: (LogLevelStr) -> None
461+
"""
462+
Sets the level for the scope.
463+
464+
:param value: The level to set.
465+
"""
451466
self._level = value
452467

453468
@_attr_setter
@@ -555,20 +570,24 @@ def profile(self, profile):
555570

556571
self._profile = profile
557572

558-
def set_tag(
559-
self,
560-
key, # type: str
561-
value, # type: Any
562-
):
563-
# type: (...) -> None
564-
"""Sets a tag for a key to a specific value."""
573+
def set_tag(self, key, value):
574+
# type: (str, Any) -> None
575+
"""
576+
Sets a tag for a key to a specific value.
577+
578+
:param key: Key of the tag to set.
579+
580+
:param value: Value of the tag to set.
581+
"""
565582
self._tags[key] = value
566583

567-
def remove_tag(
568-
self, key # type: str
569-
):
570-
# type: (...) -> None
571-
"""Removes a specific tag."""
584+
def remove_tag(self, key):
585+
# type: (str) -> None
586+
"""
587+
Removes a specific tag.
588+
589+
:param key: Key of the tag to remove.
590+
"""
572591
self._tags.pop(key, None)
573592

574593
def set_context(
@@ -577,7 +596,9 @@ def set_context(
577596
value, # type: Dict[str, Any]
578597
):
579598
# type: (...) -> None
580-
"""Binds a context at a certain key to a specific value."""
599+
"""
600+
Binds a context at a certain key to a specific value.
601+
"""
581602
self._contexts[key] = value
582603

583604
def remove_context(

0 commit comments

Comments
 (0)