Skip to content

E501: Combining diacritics counted against line length #856

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

Open
reynoldsnlp opened this issue Mar 22, 2019 · 3 comments
Open

E501: Combining diacritics counted against line length #856

reynoldsnlp opened this issue Mar 22, 2019 · 3 comments

Comments

@reynoldsnlp
Copy link

It looks like unicode combining diacritics are counted as full characters, which causes E501 to fire, even when it is visually less than 79 characters:

text = ['ся́ду', 'твёрдый', 'ю́бкой', 'ба́юшки', 'опя́ть', 'съе́сть', 'жи́ть', 'éли']
a = 'а́́́́́́́́́́́́́́́́́́́'

It seems to me that combining characters should be excluded from the count.

@sigmavirus24
Copy link
Member

Which version of python is pycodestyle running on and which version of pycodestyle are you using?

@reynoldsnlp
Copy link
Author

Python 3.6.7
pycodestyle==2.3.1

@asottile
Copy link
Member

shouldn't be too hard to implement using unicodedata:

>>> s = "a = 'а́́́́́́́́́́''а́́́́́́́́́́''а́́́́́́́́́́''а́́́́́́́́́́'"
>>> len(s)
65
>>> sum(not unicodedata.combining(c) for c in s)
16

reynoldsnlp added a commit to reynoldsnlp/pycodestyle that referenced this issue May 30, 2019
I also alphabetized the import statements by moving `bisect` to the top.
@asottile asottile changed the title E501 Combining diacritics counted against line length E501: Combining diacritics counted against line length Jun 14, 2020
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

3 participants