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 type hints from typeshed #205
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I didn't do the third part yet... Add mypy via pre-commit and make mypy pass (can be follow-up PR if there's much to do) ...as I'm newer to contributing and didn't want to get overwhelmed. I can open a new issue so that it doesn't get forgotten and work on that next.
Yep, let's keep the scope narrower for this first PR. 👍
Here's some review comments.
Now we have That means in So please also make these changes: -from typing import Any, List
+from typing import Any def test_break_line_ASCII(
- self, rows: List[List[Any]], hrule: int, expected_result: str
+ self, rows: list[list[Any]], hrule: int, expected_result: str
): |
@hugovk Awesome, thank you, this feedback is invaluable to me. I was sick on the weekend so I'm working on this now, I'll have it done today. |
Remove _typeshed reference as we don't have access to it and we can use typing.Any instead. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
for more information, see https://pre-commit.ci
Removed Callable, ClassVar, and Incomplete since they aren't used in the file. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Changed Incomplete to Any since we don't have access to the _typeshed module. Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Removed import of "List" from "typing" since we now have access to "list" from the "from __future__ import annotations" line
Done. If I'm not mistaken, the change in |
@hugovk I made the changes and changed the request from I also created an issue at #206 for the unfinished part of the issue that this pull request is based upon so that there would be no way for it to get ignored, even though I'm starting to work on it now. |
Codecov Report
@@ Coverage Diff @@
## master #205 +/- ##
==========================================
+ Coverage 94.03% 94.05% +0.01%
==========================================
Files 5 5
Lines 2248 2254 +6
==========================================
+ Hits 2114 2120 +6
Misses 134 134
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thank you! Yes, pre-commit runs tools like linters and formatters to check the code is formatted well, and for some types of errors (this is defined in Plus a test suite is run, which runs the unit tests with six versions of Python on three operating systems (they're in the And I'll review the changes to make sure they look good. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
@hugovk wow I can't thank you enough for how professional you've been answering all of my questions. Getting started making contributions to actual projects is intimidating, and having help like this is awesome. I will pay it forward and help other people when I get much better. |
You're very welcome, I'm happy to help out :) |
Issue: #203
I didn't do the third part yet...
Add mypy via pre-commit and make mypy pass (can be follow-up PR if there's much to do)
...as I'm newer to contributing and didn't want to get overwhelmed. I can open a new issue so that it doesn't get forgotten and work on that next.
Used merge_pyi to integrate the type annotations and added appropriate args to .pre-commit-config.yaml in order for pre-commit to add the import to Python files so that newer typing syntax can be used on older Python 3.7 (as described in the issue).
Note: Did not use Black to format as it was deleting spaces in the docstrings which presumably are supposed to be there; can use Black and then add the spaces again after if that's better.