grantjenks / blue

The slightly less uncompromising Python code formatter.
https://blue.readthedocs.io/
Other
393 stars 21 forks source link

Odd single-quote to double-quote change #9

Closed warsaw closed 3 years ago

warsaw commented 3 years ago

From flufl.lock 's setup.py. I'm not sure why blue changes some single-quotes to double quotes in some cases. Note that it doesn't transform them all, and the ones it does change don't have embedded single-quotes.

@@ -11,37 +11,37 @@
 with open('README.rst') as fp:
     readme = fp.read()

 setup(
-    name='flufl.lock',
+    name="flufl.lock",
     version=__version__,
     author='Barry Warsaw',
     author_email='barry@python.org',
     description=__doc__,
     long_description=readme,
     long_description_content_type='text/x-rst',
     license='Apache 2.0',
     keywords='locking locks lock',
     url='https://flufllock.readthedocs.io',
     download_url='https://pypi.python.org/pypi/flufl.lock',
-    packages=find_namespace_packages(where='.', exclude=['test*', 'docs']),
+    packages=find_namespace_packages(where=".", exclude=['test*', 'docs']),
     namespace_packages=['flufl'],
     include_package_data=True,
     # readthedocs builds fail unless zip_safe is False.
     zip_safe=False,
     python_requires='>=3.6',
     install_requires=[
         'atpublic',
         'psutil',
         'typing_extensions;python_version<"3.8"',
-        ],
+    ],
     project_urls={
         'Documentation': 'https://flufllock.readthedocs.io',
         'Source': 'https://gitlab.com/warsaw/flufl.lock.git',
         'Tracker': 'https://gitlab.com/warsaw/flufl.lock/issues',
-        },
+    },
     classifiers=[
         'Development Status :: 5 - Production/Stable',
         'Development Status :: 6 - Mature',
         'Intended Audience :: Developers',
         'License :: OSI Approved :: Apache Software License',
warsaw commented 3 years ago

Here's another case of incorrect transformation.

-            parts.append(int(''.join((split.pop(0), split.pop(0))), 16))
+            parts.append(int("".join((split.pop(0), split.pop(0))), 16))
warsaw commented 3 years ago

And another one:

@@ -12,35 +12,35 @@
 with open('README.rst') as fp:
     readme = fp.read()

 setup(
-    name='flufl.i18n',
+    name="flufl.i18n",
     version=__version__,
     author='Barry Warsaw',
     author_email='barry@python.org',
     description=__doc__,
     long_description=readme,
     long_description_content_type='text/x-rst',
     license='Apache 2.0',
     keywords='internationalization i18n',
     url='https://flufli18n.readthedocs.io',
     download_url='https://pypi.python.org/pypi/flufl.i18n',
-    packages=find_namespace_packages(where='.', exclude=['test*', 'docs']),
+    packages=find_namespace_packages(where=".", exclude=['test*', 'docs']),
     namespace_packages=['flufl'],
     include_package_data=True,
     zip_safe=False,
     python_requires='>=3.6',
     install_requires=[
         'atpublic',
         'typing_extensions;python_version<"3.8"',
-        ],
+    ],
     project_urls={
         'Documentation': 'https://flufli18n.readthedocs.io',
         'Source': 'https://gitlab.com/warsaw/flufl.i18n.git',
         'Tracker': 'https://gitlab.com/warsaw/flufl.i18n/issues',
-        },
+    },
     classifiers=[
         'Development Status :: 5 - Production/Stable',
         'Development Status :: 6 - Mature',
         'Intended Audience :: Developers',
         'License :: OSI Approved :: Apache Software License',
warsaw commented 3 years ago

This is because leaf.parent.prev_siblings is None in is_docstring() for those strings.

warsaw commented 3 years ago

Looks like this was also closed by #3