Skip to content

Make make tidy Python scripts more idiomatic #21539

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 2 commits into from
Jan 25, 2015
Merged

Make make tidy Python scripts more idiomatic #21539

merged 2 commits into from
Jan 25, 2015

Conversation

iKevinY
Copy link
Contributor

@iKevinY iKevinY commented Jan 23, 2015

Also makes errorck.py and tidy.py compatible with Python 3.

@rust-highfive
Copy link
Contributor

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)


with open(path, 'r') as f:
for line_num, line in enumerate(f, start=1):
p = re.compile("(E\d\d\d\d)")
Copy link
Contributor

Choose a reason for hiding this comment

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

move the regex compile out of the for loop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point; changing this now.

@iKevinY iKevinY changed the title Use more idiomatic Python in make tidy scripts Make make tidy Python scripts more idiomatic Jan 23, 2015
# except according to those terms.
"""
license_re = re.compile(
u"""(#|//) Copyright .* The Rust Project Developers. See the COPYRIGHT
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be a raw string literal (i.e., ur"""…"""), so all the doubled backslashes can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I implemented it this way initially, but Python 3 didn't like it.

Also makes errorck.py and tidy.py compatible with Python 3.
@alexcrichton
Copy link
Member

@bors: r+ 76c279a thanks!

@alexcrichton
Copy link
Member

@bors: rollup

flaper87 added a commit to flaper87/rust that referenced this pull request Jan 23, 2015
Also makes `errorck.py` and `tidy.py` compatible with Python 3.
flaper87 added a commit to flaper87/rust that referenced this pull request Jan 24, 2015
Also makes `errorck.py` and `tidy.py` compatible with Python 3.
bors added a commit that referenced this pull request Jan 25, 2015
@bors bors merged commit 76c279a into rust-lang:master Jan 25, 2015
@iKevinY iKevinY deleted the pythonic branch January 29, 2015 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants