Skip to content

Commit 7e52190

Browse files
committed
lint: Enable flake8-pyi
"object" is slightly more informative than "Any" as annotation Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
1 parent 981788b commit 7e52190

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ select = [
9595
"N", # pep8-naming
9696
"PL", # pylint
9797
"PIE", # flake8-pie
98+
"PYI", # flake8-pyi
9899
"RET", # flake8-return
99100
"RUF", # ruff-specific rules
100101
"S", # flake8-bandit

tuf/api/_payload.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def __init__(
133133

134134
self.unrecognized_fields = unrecognized_fields
135135

136-
def __eq__(self, other: Any) -> bool:
136+
def __eq__(self, other: object) -> bool:
137137
if not isinstance(other, Signed):
138138
return False
139139

@@ -253,7 +253,7 @@ def __init__(
253253

254254
self.unrecognized_fields = unrecognized_fields
255255

256-
def __eq__(self, other: Any) -> bool:
256+
def __eq__(self, other: object) -> bool:
257257
if not isinstance(other, Role):
258258
return False
259259

@@ -504,7 +504,7 @@ def __init__(
504504
raise ValueError("Role names must be the top-level metadata roles")
505505
self.roles = roles
506506

507-
def __eq__(self, other: Any) -> bool:
507+
def __eq__(self, other: object) -> bool:
508508
if not isinstance(other, Root):
509509
return False
510510

@@ -795,7 +795,7 @@ def __init__(
795795

796796
self.unrecognized_fields = unrecognized_fields
797797

798-
def __eq__(self, other: Any) -> bool:
798+
def __eq__(self, other: object) -> bool:
799799
if not isinstance(other, MetaFile):
800800
return False
801801

@@ -912,7 +912,7 @@ def __init__(
912912
super().__init__(version, spec_version, expires, unrecognized_fields)
913913
self.snapshot_meta = snapshot_meta or MetaFile(1)
914914

915-
def __eq__(self, other: Any) -> bool:
915+
def __eq__(self, other: object) -> bool:
916916
if not isinstance(other, Timestamp):
917917
return False
918918

@@ -975,7 +975,7 @@ def __init__(
975975
super().__init__(version, spec_version, expires, unrecognized_fields)
976976
self.meta = meta if meta is not None else {"targets.json": MetaFile(1)}
977977

978-
def __eq__(self, other: Any) -> bool:
978+
def __eq__(self, other: object) -> bool:
979979
if not isinstance(other, Snapshot):
980980
return False
981981

@@ -1066,7 +1066,7 @@ def __init__(
10661066
self.paths = paths
10671067
self.path_hash_prefixes = path_hash_prefixes
10681068

1069-
def __eq__(self, other: Any) -> bool:
1069+
def __eq__(self, other: object) -> bool:
10701070
if not isinstance(other, DelegatedRole):
10711071
return False
10721072

@@ -1226,7 +1226,7 @@ def __init__(
12261226
# of the last bin contains the number "number_of_bins -1" as a suffix.
12271227
self.suffix_len = len(f"{self.number_of_bins-1:x}")
12281228

1229-
def __eq__(self, other: Any) -> bool:
1229+
def __eq__(self, other: object) -> bool:
12301230
if not isinstance(other, SuccinctRoles):
12311231
return False
12321232

@@ -1368,7 +1368,7 @@ def __init__(
13681368

13691369
self.unrecognized_fields = unrecognized_fields
13701370

1371-
def __eq__(self, other: Any) -> bool:
1371+
def __eq__(self, other: object) -> bool:
13721372
if not isinstance(other, Delegations):
13731373
return False
13741374

@@ -1498,7 +1498,7 @@ def custom(self) -> Any:
14981498
"""
14991499
return self.unrecognized_fields.get("custom")
15001500

1501-
def __eq__(self, other: Any) -> bool:
1501+
def __eq__(self, other: object) -> bool:
15021502
if not isinstance(other, TargetFile):
15031503
return False
15041504

@@ -1642,7 +1642,7 @@ def __init__(
16421642
self.targets = targets if targets is not None else {}
16431643
self.delegations = delegations
16441644

1645-
def __eq__(self, other: Any) -> bool:
1645+
def __eq__(self, other: object) -> bool:
16461646
if not isinstance(other, Targets):
16471647
return False
16481648

tuf/api/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __init__(
131131

132132
self.unrecognized_fields = unrecognized_fields
133133

134-
def __eq__(self, other: Any) -> bool:
134+
def __eq__(self, other: object) -> bool:
135135
if not isinstance(other, Metadata):
136136
return False
137137

0 commit comments

Comments
 (0)