Skip to content
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

121 add line ending options #129

Closed
wants to merge 7 commits into from
Closed

Conversation

daira
Copy link
Contributor

@daira daira commented Oct 18, 2015

fixes #121

@daira
Copy link
Contributor Author

daira commented Oct 19, 2015

Wait, why isn't https://travis-ci.org/python-modernize/python-modernize/jobs/86099411 running test_newlines?

Signed-off-by: Daira Hopwood <[email protected]>
@daira
Copy link
Contributor Author

daira commented Oct 19, 2015

Ah, because I forgot to add the file :-p

def _to_system_newlines(s):
return s.replace(os.linesep, linesep)

refactor._to_system_newlines = _to_system_newlines
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure which I like less, changing an important value in the standard library or monkeypatching a private function in 2to3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An alternative approach is to do the refactor._to_system_newlines patch on Python 2 as well; I think that will work.

@takluyver
Copy link
Contributor

I think it's reasonable to offer users a way to explicitly set their preferred style of line endings, but I don't like the implementation based on monkeypatching stuff. I'm looking into how else it might be done.

@techtonik
Copy link
Contributor

@takluyver do we have information about which file is going to be processed and if it was processed?

@takluyver takluyver mentioned this pull request Oct 19, 2015
@daira
Copy link
Contributor Author

daira commented Oct 19, 2015

Closed in favour of either #130 or #131, depending on how we decide to do it.

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.

Preserve line separator format (Unix vs. Windows)
3 participants