Improve typing (#911)

* Make type checking more strict.

* mypy: warn about unreachable code.

* Enable warn_redundant_casts.

* Enable strict_bytes.

* Look at some warn_return_any warnings.
This commit is contained in:
Felix Fontein
2025-05-31 10:25:55 +02:00
committed by GitHub
parent 6d273bc5b7
commit 82522fc07f
20 changed files with 88 additions and 65 deletions

View File

@@ -3,11 +3,16 @@
# SPDX-License-Identifier: GPL-3.0-or-later
[mypy]
# check_untyped_defs = True
check_untyped_defs = True
# disallow_untyped_defs = True -- not yet feasible
# strict = True -- only try to enable once everything is typed
# strict = True -- only try to enable once everything (including dependencies!) is typed
strict_equality = True
strict_bytes = True
warn_redundant_casts = True
# warn_return_any = True
warn_unreachable = True
[mypy-ansible.*]
# ansible-core has no typing information