Skip to content

Commit 383e260

Browse files
committed
New API: Disable irrelevant pylint warnings
Warnings E1120 and W0212 are irrelevant in one specific case, but rule E1101 creates a lot of false-positives in tuf/metadata/api. For example, there are 4 false-positives in this file related to "meta" and "targets" fields not existing in "signed_dict" in "from_dict" functions in Timestamp, Snapshot and Targets classes. Signed-off-by: Martin Vrachev <[email protected]>
1 parent b9c70aa commit 383e260

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tuf/api/metadata.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# pylint: disable=E1101
2+
13
"""TUF role metadata model.
24
35
This module provides container classes for TUF role metadata, including methods
@@ -291,8 +293,11 @@ def from_dict(cls, signed_dict: JsonDict) -> 'Signed':
291293

292294
# Create empty object with default or parametrized constructor with
293295
# default arguments.
294-
obj = cls()
295-
obj._type = signed_dict['_type']
296+
# Warnings about rules E1120 (no-value-for-parameter) and W0212
297+
# (protected-access) are not relevant here because cls is most likely
298+
# a descendant of "Signed" and we need to setup the appropriate fields.
299+
obj = cls() # pylint: disable=E1120
300+
obj._type = signed_dict['_type'] # pylint: disable=W0212
296301
obj.version = signed_dict['version']
297302
obj.spec_version = signed_dict['spec_version']
298303
# Convert 'expires' TUF metadata string to a datetime object, which is

0 commit comments

Comments
 (0)