File tree 1 file changed +6
-10
lines changed
1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -248,16 +248,12 @@ def wrapper(*args, **kwargs):
248
248
249
249
old_doc = inspect .cleandoc (old_doc or '' ).strip ('\n ' )
250
250
251
- message = message .strip ()
252
- # Add "Deprecated" to top of docstring
253
- new_doc = '[*Deprecated*] {old_doc}\n ' .format (old_doc = old_doc )
254
- # Add a notes section if one isn't already present
255
- note_section = '\n Notes\n -----'
256
- if note_section not in new_doc :
257
- new_doc += note_section
258
- # Add deprecated message
259
- new_doc += ('\n .. deprecated:: {since}\n '
260
- ' {message}' .format (since = since , message = message ))
251
+ notes_header = '\n Notes\n -----'
252
+ new_doc = (f"[*Deprecated*] { old_doc } \n "
253
+ f"{ notes_header if notes_header not in old_doc else '' } \n "
254
+ f".. deprecated:: { since } \n "
255
+ f" { message .strip ()} " )
256
+
261
257
if not old_doc :
262
258
# This is to prevent a spurious 'unexpected unindent' warning from
263
259
# docutils when the original docstring was blank.
You can’t perform that action at this time.
0 commit comments