-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disambiguate shadowed builtins without API break
This suppresses A003 for `list` builtin. `typing.List`, `typing.Dict`, `typing.Tuple` and `typing.Type` are deprecated. Removing these annotations breaks the calls to `list` when they are done within the same class scope, which makes them ambiguous. Typed returns `list` resolve to the function `list` defined in the class, shadowing the builtin function. This change is not great but a proper one would require changing the name of the class function `list` and breaking the API to be fixed. Example of where it breaks: podman/domains/images_manager.py class ImagesManager(...): def list(...): ... def pull( self, ... ) -> Image | list[Image], [[str]]: ... Here, the typed annotation of `pull` would resolve to the `list` method, rather than the builtin. Signed-off-by: Nicola Sella <[email protected]>
- Loading branch information
Showing
2 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters