click icon indicating copy to clipboard operation
click copied to clipboard

Add typing to pass pyright

Open dzcode opened this issue 3 years ago • 0 comments

Fix the overwhelming majority of issues identified by pyright. The only remaining issues are of the form:

click.types.File.envvar_list_splitter
  /click/src/click/types.py:658:5 - error: Ambiguous base class override
    Type declared in base class is "str | None"
    Type inferred in child class is "str"
    Inferred child class type is missing type annotation and could be inferred differently by type checkers

Trying to correct this issue by adding an annotation conflicts with mypy, since mypy will then raise an error:

src/click/types.py:658: error: Cannot override class variable (previously declared on base class "ParamType") with instance variable  [misc]

I've left it so mypy remains passing.

  • fixes #2268

Checklist:

  • [ ] Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • [ ] Add or update relevant docs, in the docs folder and in code.
  • [x] Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • [ ] Add .. versionchanged:: entries in any relevant code docs.
  • [x] Run pre-commit hooks and fix any issues.
  • [x] Run pytest and tox, no tests failed.

dzcode avatar May 02 '22 20:05 dzcode