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

Complete type annotations: pip/_internal/models #10138

Merged
merged 23 commits into from
Jul 12, 2021

Conversation

DiddiLeija
Copy link
Member

Convert type commentaries into proper annotations on pip/_internal/models.

Convert type commentaries into proper annotations.
Fix them on "direct_url.py".
The news entry for my pull request.
@DiddiLeija
Copy link
Member Author

Seems like there are some forward references. I'll fix them in a commit.

Convert some annotations into strings.
Fix them on "format_control.py".
Add a missing bracket.
The line was too long (90 > 88 characters).
Fix them on "scheme.py".

Translate the original type hint commentary and add the return value (as "None").
@DiddiLeija
Copy link
Member Author

DiddiLeija commented Jul 6, 2021

Seems like the modifications I made on link.py had some side effects:

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

src/pip/_internal/index/collector.py:272: error: Argument "comes_from" to
"Link" has incompatible type "str"; expected "Optional[HTMLPage]"
            comes_from=page_url,
                       ^
Found 1 error in 1 file (checked 150 source files)

How can I fix it? Must I change the original annotation?

The mypy test suggested to change this annotation:

    comes_from: Optional[Union[HTMLPage]] = None,

with this one:

    comes_from: Optional[HTMLPage] = None,
It was not necessary (and it was incorrect). The required fix has not been defined yet.
The argument "comes_from" can be "str" or "HTMLPage".
@DiddiLeija
Copy link
Member Author

I think this pull request is ready to be reviewed again. What do you think about it?

@uranusjr uranusjr merged commit 6958b87 into pypa:main Jul 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants