8000 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
Make the script to not stop on the first occurrence at each file.
  • Loading branch information
MomIsBestFriend committed Dec 25, 2019
commit d920bfd1f146e80d1ca8c957db57659cce920e65
6 changes: 4 additions & 2 deletions scripts/validate_string_concatenation.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ def is_concatenated(file_path):
0 - All good.
1 - Needs to be fixed.
"""
need_fix = False
with open(file_path, "r") as file_name:
toks = list(tokenize.generate_tokens(file_name.readline))
for i in range(len(toks) - 1):
tok = toks[i]
tok2 = toks[i + 1]
if tok[0] == token.STRING and tok[0] == tok2[0]:
need_fix = True
print(
"{file_path}:{line_number}:\t{start} and {end}".format(
Copy link
Member

Choose a reason for hiding this comment

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

f string?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I already answered above 😄

file_path=file_path,
Expand All @@ -65,8 +67,8 @@ def is_concatenated(file_path):
end=tok2[1],
)
)
return 1
return 0

return int(need_fix)


if __name__ == "__main__":
Expand Down
0