Skip to content

Commit

Permalink
refactor: Don't emit deprecation warnings through own usage of deprec…
Browse files Browse the repository at this point in the history
…ated API

Issue-mkdocstrings#676: mkdocstrings/mkdocstrings#676
  • Loading branch information
pawamoy committed Aug 9, 2024
1 parent 03bdec6 commit 9922d74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/_griffe/docstrings/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def docstring_warning( # type: ignore[misc]
"""
# YORE: Bump 1: Remove block.
if name is not None:
warnings.warn("The `name` parameter is deprecated.", DeprecationWarning, stacklevel=1)
if not name.startswith("griffe."):
warnings.warn("The `name` parameter is deprecated.", DeprecationWarning, stacklevel=1)
logger = get_logger(name)
else:
if docstring is _sentinel or offset is _sentinel or message is _sentinel:
Expand Down
5 changes: 2 additions & 3 deletions src/_griffe/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def _patch_logger(cls, get_logger_func: Callable) -> None:

# YORE: Bump 1: Remove block.
def get_logger(name: str) -> Logger:
# YORE: Bump 1: Replace `Deprecated.` with `Deprecated, use [logger][griffe.logger] directly.`.
"""Deprecated. Create and return a new logger instance.
Parameters:
Expand All @@ -113,8 +112,8 @@ def get_logger(name: str) -> Logger:
Returns:
The logger.
"""
# YORE: Bump 1: Replace `deprecated.` with `deprecated. Use [logger][griffe.logger] directly.`.
warnings.warn("The `get_logger` function is deprecated.", DeprecationWarning, stacklevel=1)
if not name.startswith("griffe."):
warnings.warn("The `get_logger` function is deprecated.", DeprecationWarning, stacklevel=1)
return Logger._get(name)


Expand Down

0 comments on commit 9922d74

Please # to comment.