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

Handle docstrings in single quoted strings correctly #46

Merged
merged 3 commits into from
Feb 10, 2022

Conversation

DanielNoord
Copy link
Owner

Fixes a part of #45.

I'd like to add the quotes formatter as well to 0.4.0 so we can also fix the underlying issue when running the formatter over pylint 😄

@DanielNoord DanielNoord added the bug Something isn't working label Feb 10, 2022
@DanielNoord DanielNoord added this to the 0.4.0 milestone Feb 10, 2022
@coveralls
Copy link

coveralls commented Feb 10, 2022

Pull Request Test Coverage Report for Build 1824561971

  • 25 of 25 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 1822900243: 0.0%
Covered Lines: 344
Relevant Lines: 344

💛 - Coveralls

return tokenize.TokenInfo(
tokeninfo.type,
self._treat_string(tokeninfo, tokeninfo.start[1]),
self._treat_string(tokeninfo, tokeninfo.start[1], quotes),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we could handle the quote detection in this function and give the string to the function ? And maybe create a StringWithOriginalQuoteFormatter ? It would make less arguments passed around ànd named _ for StringFormatter

Copy link
Owner Author

Choose a reason for hiding this comment

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

Maybe we could handle the quote detection in this function and give the string to the function ?

We're doing that now right?

And maybe create a StringWithOriginalQuoteFormatter ? It would make less arguments passed around ànd named _ for StringFormatter

Good idea! I will do that!

@DanielNoord
Copy link
Owner Author

Note, this should be rebased not squashed due to the other two commits.

tokeninfo,
tokeninfo.start[1],
quotes,
quotes_length, # type: ignore[arg-type]
Copy link
Owner Author

Choose a reason for hiding this comment

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

Both mypy and pyright don't acknowledge that quotes_length is 1 or 3. pyright does if you use (1,3), but then pylint complains about set comparison.

Copy link
Collaborator

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

👌

@DanielNoord DanielNoord merged commit 41502e9 into main Feb 10, 2022
@DanielNoord DanielNoord deleted the find-docstrings branch February 10, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants