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

Add support for all valid string literals #115

Merged
merged 5 commits into from Apr 9, 2018
Merged

Add support for all valid string literals #115

merged 5 commits into from Apr 9, 2018

Conversation

zsol
Copy link
Collaborator

@zsol zsol commented Apr 6, 2018

Fixes #3. This was the cause for black not being able to support rf strings. Now this forked version of lib2to3 only parses valid string literals as defined by https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals

@coveralls
Copy link

Pull Request Test Coverage Report for Build 181

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 90.42%

Totals Coverage Status
Change from base Build 178: 0.0%
Covered Lines: 1378
Relevant Lines: 1524

💛 - Coveralls

1 similar comment
@coveralls
Copy link

Pull Request Test Coverage Report for Build 181

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 90.42%

Totals Coverage Status
Change from base Build 178: 0.0%
Covered Lines: 1378
Relevant Lines: 1524

💛 - Coveralls

@coveralls
Copy link

coveralls commented Apr 6, 2018

Pull Request Test Coverage Report for Build 191

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 90.42%

Totals Coverage Status
Change from base Build 178: 0.0%
Covered Lines: 1378
Relevant Lines: 1524

💛 - Coveralls


_strprefixes = set(combinations('r', 'R', 'f', 'F') +
combinations('r', 'R', 'b', 'B') +
['u', 'U'])
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're missing 'uR', 'UR', 'Ur', 'ur' which is valid on Python 2.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

uR right 🤣 I was wondering why tokenize used to accept this in the regex above.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Funnily enough, since we are still supporting u"" in Python 3, not supporting ur"" is likely just an omission of whoever brought u"" back :-)

return [(x + y).strip() for x in l for y in l + (" ",) if x.casefold() != y.casefold()]
def _combinations(*l):
return set(
x + y for x in l for y in l + ("",) if x.casefold() != y.casefold()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That needs to be a (" ",) in the middle

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh nevermind

@ambv ambv merged commit ecdbf08 into psf:master Apr 9, 2018
@ambv
Copy link
Collaborator

ambv commented Apr 9, 2018

Thanks! ✨ 🍰 ✨

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.

None yet

3 participants