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

PEP 263 fixer #183

Open
jayvdb opened this issue Apr 15, 2019 · 1 comment
Open

PEP 263 fixer #183

jayvdb opened this issue Apr 15, 2019 · 1 comment

Comments

@jayvdb
Copy link
Member

jayvdb commented Apr 15, 2019

I had a case recently, sorry I cant find it atm, where the code is using unicode literal values, but without an encoding declared for the source file. I was expecting 2to3 or modernizer would add PEP 263 (coding=...) headers to the files, but couldnt find one fixer for it.

It would be quite easy to do for the most common case of unicode, even without any attempt at detecting the real encoding. A default disabled fixer maybe?

@jayvdb jayvdb changed the title Add encoding PEP 263 fixer Apr 15, 2019
@takluyver
Copy link
Contributor

I think both 2to3 and modernize generally assume that the input is valid Python 2 source code - which means a file with any non-ASCII characters should already have an encoding comment. But I've no objection to adding a fixer if you can see how 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

No branches or pull requests

2 participants