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