Recommend to use mypy error codes if applicable (#6305)

This commit is contained in:
Sebastian Rittau
2021-11-18 06:58:05 +01:00
committed by GitHub
parent ccc09aa196
commit 77810277d5
3 changed files with 16 additions and 13 deletions

View File

@@ -389,7 +389,9 @@ Some further tips for good type hints:
* in Python 2, whenever possible, use `unicode` if that's the only
possible type, and `Text` if it can be either `unicode` or `bytes`;
* use platform checks like `if sys.platform == 'win32'` to denote
platform-dependent APIs.
platform-dependent APIs;
* use mypy error codes for mypy-specific `# type: ignore` annotations,
e.g. `# type: ignore[override]` for Liskov Substitution Principle violations.
Imports in stubs are considered private (not part of the exported API)
unless: