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

pkg_resources: Remove stray Anys and use more Self & NoReturn types #11528

Merged
merged 4 commits into from
Mar 8, 2024

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Mar 4, 2024

Extracted from, and improved over #11455
Works towards #9550


class ResolutionError(Exception): ...

class DistributionNotFound(ResolutionError):
def __init__(self, req: Requirement, requirers: set[str] | None, /, *args: object) -> None: ...
Copy link
Collaborator Author

@Avasam Avasam Mar 4, 2024

Choose a reason for hiding this comment

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

ResolutionError subclasses still work with any number of arguments which will show up in the __repr__ string

This comment has been minimized.

@@ -333,7 +333,7 @@ class NullProvider:
def metadata_isdir(self, name: str) -> bool: ...
def resource_listdir(self, resource_name) -> list[str]: ...
def metadata_listdir(self, name: str) -> list[str]: ...
def run_script(self, script_name: str, namespace: Mapping[str, object]) -> None: ...
def run_script(self, script_name: str, namespace: dict[str, Any]) -> None: ...
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Taken from

typeshed/stdlib/builtins.pyi

Lines 1330 to 1331 in 35b74bc

__globals: dict[str, Any] | None = None,
__locals: Mapping[str, object] | None = None,

Copy link
Contributor

github-actions bot commented Mar 4, 2024

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit 52daae5 into python:main Mar 8, 2024
43 checks passed
@Avasam Avasam deleted the pkg_resources-Any-Self-NoReturn branch March 8, 2024 02:28
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.

2 participants