Copies and docstring styling (#15202)

* Style docstrings when making/checking copies

* Polish
This commit is contained in:
Sylvain Gugger
2022-01-18 09:16:55 -05:00
committed by GitHub
parent 531336bbfd
commit 1144d336b6
2 changed files with 30 additions and 11 deletions

View File

@@ -19,6 +19,7 @@ import os
import re
import black
from style_doc import style_docstrings_in_code
# All paths are set with the intent you should run this script from the root of the repo with the command
@@ -130,6 +131,7 @@ def blackify(code):
if has_indent:
code = f"class Bla:\n{code}"
result = black.format_str(code, mode=black.FileMode([black.TargetVersion.PY35], line_length=119))
result, _ = style_docstrings_in_code(result)
return result[len("class Bla:\n") :] if has_indent else result