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

Function deprecated

markdown/util.py:114–136  ·  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

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