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

Merge and update variable and params annotations from typeshed #4246

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

Avasam
Copy link
Contributor

@Avasam Avasam commented Feb 28, 2024

Summary of changes

Merge and update (because they were not all correct or exact) variable and params annotations from typeshed. Missing public annotations are missing from typeshed too.
This PR purposefully avoids adding TypeVars, overloads and return types. Those will all be tackled in a follow-up PR. Return types are inferred at this step.

Step 3.1 of #2345 (comment) but only for pkg_resources

Pull Request Checklist

@Avasam Avasam force-pushed the pkg_resources-variables-params-annotations branch 4 times, most recently from e179ba7 to c9c9332 Compare February 28, 2024 05:51
@Avasam Avasam force-pushed the pkg_resources-variables-params-annotations branch from c9c9332 to b0e1a1e Compare February 28, 2024 06:10
Comment on lines +133 to +137
_NestedStr = Union[str, Iterable[Union[str, Iterable["_NestedStr"]]]]
_InstallerType = Callable[["Requirement"], Optional["Distribution"]]
_PkgReqType = Union[str, "Requirement"]
_EPDistType = Union["Distribution", _PkgReqType]
_MetadataType = Optional["IResourceProvider"]
Copy link
Contributor Author

@Avasam Avasam Feb 29, 2024

Choose a reason for hiding this comment

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

These aliases come from the typeshed stub. Please lmk if you'd prefer different names or to make them public.

require = None
working_set = None
require = cast("Callable[..., Any]", None)
working_set = cast("WorkingSet", None)
add_activation_listener = None
cleanup_resources = None
resource_stream = None
Copy link
Contributor Author

@Avasam Avasam Mar 6, 2024

Choose a reason for hiding this comment

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

I feel like the way it's been done in https://github.com/pypa/setuptools/pull/4242/files#diff-e3d3d454fa3a072c9f46f8affa27513892fbc2d245e87f57a5927a7be851de05R3332-R3349 is better than casting all these with forward references and redefining callable types.

Comment on lines 1742 to 1744
egg_name: str
egg_info: str

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
egg_name: str
egg_info: str

Actually there's no assurance that an egg is even found.

@Avasam
Copy link
Contributor Author

Avasam commented Apr 21, 2024

As draft until #4262 and #4267 are completed

@Avasam Avasam requested a review from jaraco April 21, 2024 20:21
@Avasam Avasam marked this pull request as ready for review May 7, 2024 19:12
@Avasam Avasam force-pushed the pkg_resources-variables-params-annotations branch from fcca83f to 93053ec Compare May 7, 2024 19:57
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

2 participants