MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / deprecated

Function deprecated

markdown/util.py:111–133  ·  view source on GitHub ↗

Raise a [`DeprecationWarning`][] when wrapped function/method is called. Usage: ```python @deprecated("This method will be removed in version X; use Y instead.") def some_method(): pass ```

(message: str, stacklevel: int = 2)

Source from the content-addressed store, hash-verified

109
110
111def deprecated(message: str, stacklevel: int = 2):
112 """
113 Raise a [`DeprecationWarning`][] when wrapped function/method is called.
114
115 Usage:
116
117 ```python
118 @deprecated("This method will be removed in version X; use Y instead.")
119 def some_method():
120 pass
121 ```
122 """
123 def wrapper(func):
124 @wraps(func)
125 def deprecated_func(*args, **kwargs):
126 warnings.warn(
127 f"'{func.__name__}' is deprecated. {message}",
128 category=DeprecationWarning,
129 stacklevel=stacklevel
130 )
131 return func(*args, **kwargs)
132 return deprecated_func
133 return wrapper
134
135
136def parseBoolValue(value: str | None, fail_on_errors: bool = True, preserve_none: bool = False) -> bool | None:

Callers 1

abbr.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected