Skip to content

bpo-35282: Add a return value to lib2to3.refactor_file and refactor_dir #10618

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

Closed
wants to merge 6 commits into from
Closed

bpo-35282: Add a return value to lib2to3.refactor_file and refactor_dir #10618

wants to merge 6 commits into from

Conversation

martindemello
Copy link
Contributor

@martindemello martindemello commented Nov 20, 2018

lib2to3.refactor.refactor_file returns None (file read failed), True (file was written to) or False (file was not written to)
lib2to3.refactor.refactor_dir returns a list of changed files

https://bugs.python.org/issue35282

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Our records indicate we have not received your CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

@martindemello martindemello changed the title bpo35282: Add a return value to lib2to3.refactor_file and refactor_dir bpo-35282: Add a return value to lib2to3.refactor_file and refactor_dir Nov 20, 2018
Copy link
Member

@zware zware left a comment

Choose a reason for hiding this comment

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

This looks like a reasonable change to me, though the refactor_file docstring could do with an update.

@benjaminp
Copy link
Contributor

Is this really enough? You don't want to distinguish changed files from unreadable ones?

@martindemello
Copy link
Contributor Author

@benjaminp do you mean refactor_dir should distinguish between files that could not be read and files that were simply not refactored?

@benjaminp
Copy link
Contributor

Maybe. I suppose I want to understand the usecase for this. Starting to provide a list return value prevents us from extending the returned information in the future.

@martindemello
Copy link
Contributor Author

sorry, missed ths comment. my use case was to run modernize on a list of files and see which ones had and had not been changed - if modernize had touched a file at all i wanted to do extra processing on it (e.g. run a formatter), but leave untouched files alone.

@csabella csabella requested review from benjaminp and zware June 12, 2020 12:25
@iritkatriel
Copy link
Member

iritkatriel commented Oct 20, 2021

Closed under bpo-45544.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants