typeshed
typeshed copied to clipboard
`pkg_resources` (setuptools): Make stubtest-complete and pyright-strict
The first commit only reorder names to be closer to implementation. Making it easier to compare with the original code, and reducing changes in the following commit. Whilst still avoiding forward referenced.
So why even complete pkg_resources
in the first place, if it's considered deprecated in favor of importlib.resources
, importlib.metadata
and their backports?
Because I've started merging the stubs directly into the setuptools repo, with the goal of being able to take it out of typeshed. And in doing so, found a lot of improvements to the typeshed stubs. At that point I was a few changes away from completing it, so here it is.
This also allowed me to cross-validate a handful of annotations, and I'll use the typeshed stubs as the reference for an upcoming PR that finishes typing pkg_resources
upstream.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
Diff from mypy_primer, showing the effect of this PR on open source code:
bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/storage.py: note: In function "load_storage_plugins":
+ src/bandersnatch/storage.py:371: error: Module not callable [operator]
+ src/bandersnatch/filter.py: note: In member "_load_filters" of class "LoadedFilters":
+ src/bandersnatch/filter.py:192: error: Module not callable [operator]
isort (https://github.com/pycqa/isort)
+ isort/settings.py:367: error: Argument 2 to "setdefault" of "MutableMapping" has incompatible type Module; expected "Dict[str, Any]" [arg-type]
+ isort/settings.py:725: error: Incompatible types in assignment (expression has type Module, variable has type "Optional[Callable[..., List[str]]]") [assignment]
+ isort/settings.py:730: error: Incompatible return value type (got "Union[Callable[[Iterable[str], Optional[Callable[[str], Any]], bool], List[str]], overloaded function, None]", expected "Callable[..., List[str]]") [return-value]
alerta (https://github.com/alerta/alerta)
- alerta/utils/plugin.py:49: error: Unused "type: ignore" comment [unused-ignore]
+ alerta/utils/webhook.py:31: error: Module not callable [operator]
+ alerta/utils/plugin.py:42: error: Module not callable [operator]
Diff from mypy_primer, showing the effect of this PR on open source code:
bandersnatch (https://github.com/pypa/bandersnatch)
+ src/bandersnatch/storage.py: note: In function "load_storage_plugins":
+ src/bandersnatch/storage.py:371: error: Module not callable [operator]
+ src/bandersnatch/filter.py: note: In member "_load_filters" of class "LoadedFilters":
+ src/bandersnatch/filter.py:192: error: Module not callable [operator]
isort (https://github.com/pycqa/isort)
+ isort/settings.py:367: error: Argument 2 to "setdefault" of "MutableMapping" has incompatible type Module; expected "Dict[str, Any]" [arg-type]
+ isort/settings.py:725: error: Incompatible types in assignment (expression has type Module, variable has type "Optional[Callable[..., List[str]]]") [assignment]
+ isort/settings.py:730: error: Incompatible return value type (got "Union[Callable[[Iterable[str], Optional[Callable[[str], Any]], bool], List[str]], overloaded function, None]", expected "Callable[..., List[str]]") [return-value]
alerta (https://github.com/alerta/alerta)
- alerta/utils/plugin.py:49: error: Unused "type: ignore" comment [unused-ignore]
+ alerta/utils/webhook.py:31: error: Module not callable [operator]
+ alerta/utils/plugin.py:42: error: Module not callable [operator]
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
Self-reviewing the amount of changes in 1 file, I'll put this back as draft and split it up in smaller chunks.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉