Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Closed
martindemello wants to merge 6 commits into
python:mainpython/cpython:mainfrom
martindemello:lib2to3-refactor-return-valueCopy head branch name to clipboard
Closed

bpo-35282: Add a return value to lib2to3.refactor_file and refactor_dir#10618
martindemello wants to merge 6 commits into
python:mainpython/cpython:mainfrom
martindemello:lib2to3-refactor-return-valueCopy head branch name to clipboard

Conversation

@martindemello

@martindemello martindemello commented Nov 20, 2018

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

@zware zware left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Lib/lib2to3/refactor.py
@benjaminp

Copy link
Copy Markdown
Contributor

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

@martindemello

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

iritkatriel commented Oct 20, 2021

Copy link
Copy Markdown
Member

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.