Skip to content

Commit 1c95fa9

Browse files
Update MyPy settings (sigstore#1322)
* Enable MyPy strict mode MyPy is best with strict or nearly strict configuration. Alternatively, set `strict = false`. Signed-off-by: Dimitri Papadopoulos <[email protected]> * Remove deprecated `show_error_codes` from MyPy config Since MyPy v0.990, `show_error_codes = true` the default. Signed-off-by: Dimitri Papadopoulos <[email protected]> * Enable `ignore-without-code` in MyPy config This will force all skips to include the error code, which makes them more readable, and avoids skipping something unintended. Signed-off-by: Dimitri Papadopoulos <[email protected]> * Enable `redundant-expr` in MyPy config This helps catch useless lines of code, like checking the same condition twice. Signed-off-by: Dimitri Papadopoulos <[email protected]> * Enable `truthy-bool` in MyPy config This catches mistakes in using a value as truthy if it cannot be falsy. Signed-off-by: Dimitri Papadopoulos <[email protected]> * Fix MyPy [type-arg] error Missing type parameters for generic type "dict". Signed-off-by: Dimitri Papadopoulos <[email protected]> * Fix MyPy [attr-defined] error Module "tuf.ngclient" does not explicitly export attributes. Signed-off-by: Dimitri Papadopoulos <[email protected]> --------- Signed-off-by: Dimitri Papadopoulos <[email protected]>
1 parent 97634e6 commit 1c95fa9

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,11 @@ allow_redefinition = true
104104
check_untyped_defs = true
105105
disallow_incomplete_defs = true
106106
disallow_untyped_defs = true
107+
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
107108
ignore_missing_imports = true
108109
no_implicit_optional = true
109-
show_error_codes = true
110110
sqlite_cache = true
111+
strict = true
111112
strict_equality = true
112113
warn_no_return = true
113114
warn_redundant_casts = true

sigstore/_internal/rekor/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class RekorLogInfo:
4747
tree_size: int
4848
signed_tree_head: str
4949
tree_id: str
50-
raw_data: dict
50+
raw_data: dict[str, Any]
5151

5252
@classmethod
5353
def from_response(cls, dict_: dict[str, Any]) -> RekorLogInfo:

sigstore/_internal/tuf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import platformdirs
2727
from tuf.api import exceptions as TUFExceptions
28-
from tuf.ngclient import Updater, UpdaterConfig
28+
from tuf.ngclient import Updater, UpdaterConfig # type: ignore[attr-defined]
2929

3030
from sigstore import __version__
3131
from sigstore._utils import read_embedded

0 commit comments

Comments
 (0)