10000 STY: Removed unconcatenated strings by ShaharNaveh · Pull Request #30464 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

STY: Removed unconcatenated strings #30464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 25, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes for jbrockmendel's review
  • Loading branch information
MomIsBestFriend committed Dec 25, 2019
commit edb2da1d348705149f0105169dd56aa6459698fd
22 changes: 20 additions & 2 deletions scripts/validate_string_concatenation.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
#!/usr/bin/env python
"""
GH #30454

Check where there is a string that needs to be concatenated.

This is necessary after black formating,
where for example black transforms this:

>>> foo = (
... "bar "
... "baz"
... )

into this:

>>> foo = ("bar " "baz")

Black is not considering this as an
issue (see https://github.com/psf/black/issues/1051), so we are checking
it here.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you flesh this out with a GH reference and a sentence about how black causes the issue


import os
import sys
import token
import tokenize

FILE_EXTENTIONS_TO_CHECK = [".pxd", ".py", ".pyx", ".pyx.ini"]
FILE_EXTENSIONS_TO_CHECK = [".pxd", ".py", ".pyx", ".pyx.ini"]


def main():
Expand All @@ -26,7 +44,7 @@ def main():
for subdir, _, files in os.walk(path):
for file_name in files:
ext = full_ext(os.path.join(subdir, file_name))
if ext in FILE_EXTENTIONS_TO_CHECK:
if ext in FILE_EXTENSIONS_TO_CHECK:
status_codes.add(is_concatenated(os.path.join(subdir, file_name)))

if 1 in status_codes:
Expand Down
0