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
Convert type hint comments into annotations #10018
Conversation
As I said on the pypa/pip PR pypa#10004, it is necessary to remove the comments and use the `typing` annotations instead.
This will help to build the documentation.
I propose to change all the files that used the `typing` module. On this file, I found a way to improve that topic.
Co-authored-by: Pradyun Gedam <pradyunsg@gmail.com>
If I can help with something else, I offer to take care of the issue. Just tell me. |
I deleted the comments and replaced them with proper annotations.
Remove (most) of the annotation commentaries and use proper annotations.
Sorry, I have a question: Why does the |
Using `List(Any)` is wrong, so I must use `List[Any]`.
I would like to know why does the check fails. Am I doing something wrong? |
Fix cmdoptions.py by removing the comments on the functions and using proper annotations.
The check is making sure that the annotations and code formatting are correct. If you click on details, it will show you what's wrong and possibly, what the fix for it is. |
Ok, I will try it, thank you. |
The object type "None" cannot be annotated. I had to remove them.
Sorry, I just can't find mymistakes. I looked for the CI report. It gave me this message:
Everything seems fine for me. What am I doing wrong? |
I've been trying to find my mistake on the check details, but I haven't found anything or, I don't understand where the problem is. That is confusing for me. Can somebody help me, please? |
It means your line is too long and need to be broken into like the |
Oh, got it. I will fix that as soon as I can. Thank you, @uranusjr and @pradyunsg . |
Break long annotation lines into short lines.
Fix long/short annotations at function definitions
Break long annotations into short annotations
Some of them were too large, others were too long.
I fixed most of the errors. But I'm still having this message:
What am I missing? |
A Python function returning nothing is implicitly returning None, and need to be annotated as def function_name(...) -> None:
... |
Understood. I will work on it today. Thank you. |
When a function returns nothing, it must be annotated, too.
Use proper annotations instead of commentaries.
Use anotations instead of commentaries.
Some of them were not correct.
Some of them were not annotated correctly.
I've been fixing these files:
Is anything ok? |
One of those annotations was too long.
NOTE: On my latest commit, I wanted to say "Fix the annotation length". Sorry 😅 |
This will likely be squashed into one commit when merging, so that’s fine. |
I would suggest finding a place to stop and call for a merge. Pip has a lot of files, and if you do them all at once this will take forever. |
It's true. Maybe we can stop here, when the CI checks get completed. |
Everything is done. You can merge, if you want. Thank you very much for your time 😄 . |
Add a return value annotation. Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
I think everything is done. You can merge this branch, if you want. Thanks, @pradyunsg and @uranusjr for all your help. |
I think there is nothing to modify on the files I changed. I can't merge, but you can do it. (And sorry, @pradyunsg . I requested yor review accidentally 😬 ) |
This is the second part of my job made on pypa#10018, where I must complete all the annotations from `pip/_internal/cli`.
As I said on the pypa/pip PR #10004, it is necessary to remove the comments and use the
typing
annotations instead.