Describe the bug
previously running with --skip-string-normalization would ignore triple-quoted strings that used single quote character '
To Reproduce Steps to reproduce the behavior:
def test_function():
'''this is my docstring'''
pass
--skip-string-normalizationdo the same steps after installing 19.10.0b
Expected behavior
skip string normalization should ignore triple quoted strings
Environment (please complete the following information):
Does this bug also happen on master?
yes
Additional context
n/a
Hello @zdelagrange,
I cannot reproduce the bug:
(black-rHKUX7ap) R:\Programming\black>type temp.py
def test_function():
'''this is my docstring'''
pass
(black-rHKUX7ap) R:\Programming\black>black temp.py --diff --color -S
All done! ✨ 🍰 ✨
1 file would be left unchanged.
Environment:
master (20f74c20f7efe80f0b0199153934dddd80e21d8e)CPython 3.8.1Windows 10 Home Edition Build 18363alrighty, here's a play-by-play of my console
black_test ❯ pip freeze | grep black
black==19.10b0
~/src/black_test master*
black_test ❯ cat black.py
def function_one(arg1, arg2, arg3):
'''
docstring
'''
pass
~/src/black_test master*
black_test ❯ black --skip-string-normalization black.py
All done! ✨ 🍰 ✨
1 file left unchanged.
~/src/black_test master*
black_test ❯ pip install black --upgrade
Collecting black
Using cached https://files.pythonhosted.org/packages/8a/7c/a6cdd4c69e1377d917e0b9fe44acb8f42d340ac35bcf66020136cd00c62a/black-20.8b1-py3-none-any.whl
Requirement already satisfied, skipping upgrade: typed-ast>=1.4.0 in /Users/zacdelagrange/envs/black_test/lib/python3.6/site-packages (from black) (1.4.1)
Requirement already satisfied, skipping upgrade: pathspec<1,>=0.6 in /Users/zacdelagrange/envs/black_test/lib/python3.6/site-packages (from black) (0.8.0)
Requirement already satisfied, skipping upgrade: appdirs in /Users/zacdelagrange/envs/black_test/lib/python3.6/site-packages (from black) (1.4.4)
Requirement already satisfied, skipping upgrade: click>=7.1.2 in /Users/zacdelagrange/envs/black_test/lib/python3.6/site-packages (from black) (7.1.2)
Requirement already satisfied, skipping upgrade: toml>=0.10.1 in /Users/zacdelagrange/envs/black_test/lib/python3.6/site-packages (from black) (0.10.1)
Requirement already satisfied, skipping upgrade: regex>=2020.1.8 in /Users/zacdelagrange/envs/black_test/lib/python3.6/site-packages (from black) (2020.7.14)
Requirement already satisfied, skipping upgrade: mypy-extensions>=0.4.3 in /Users/zacdelagrange/envs/black_test/lib/python3.6/site-packages (from black) (0.4.3)
Requirement already satisfied, skipping upgrade: dataclasses>=0.6; python_version < "3.7" in /Users/zacdelagrange/envs/black_test/lib/python3.6/site-packages (from black) (0.7)
Requirement already satisfied, skipping upgrade: typing-extensions>=3.7.4 in /Users/zacdelagrange/envs/black_test/lib/python3.6/site-packages (from black) (3.7.4.3)
Installing collected packages: black
Found existing installation: black 19.10b0
Uninstalling black-19.10b0:
Successfully uninstalled black-19.10b0
Successfully installed black-20.8b1
You are using pip version 18.1, however version 20.2.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
~/src/black_test master*
black_test ❯ cat black.py
def function_one(arg1, arg2, arg3):
'''
docstring
'''
pass
~/src/black_test master*
black_test ❯ black --skip-string-normalization black.py
reformatted black.py
All done! ✨ 🍰 ✨
1 file reformatted.
~/src/black_test master*
black_test ❯ cat black.py
def function_one(arg1, arg2, arg3):
"""
docstring
"""
pass
~/src/black_test master*
black_test ❯
Oh my that is a surprising bug! I can reproduce using the same environment as I posted above.
Git bisect points to commit a4c11a75e12300abfbe4c36854e450d42bdd1ee7, from "Re-indent the contents of docstrings" (PR #1053).
Good catch, we'll fix it in the next release which is planned for the week of Sept 28th (likely Oct 1). If this is a deal breaker for you, I suggest pinning to 19.10b0 in the mean time.