@@ -96,8 +96,8 @@ class also that has a 'from_dict' factory method. (Currently this is
96
96
# metadata['signatures'], call Signature.from_dict for each item, and
97
97
# pass a list of Signature objects to the Metadata constructor intead.
98
98
return cls (
99
- signed = inner_cls .from_dict (metadata ['signed' ]),
100
- signatures = metadata ['signatures' ])
99
+ signed = inner_cls .from_dict (metadata ['signed' ]),
100
+ signatures = metadata ['signatures' ])
101
101
102
102
103
103
@classmethod
@@ -122,7 +122,7 @@ def from_json(cls, metadata_json: str) -> 'Metadata':
122
122
def from_json_file (
123
123
cls , filename : str ,
124
124
storage_backend : Optional [StorageBackendInterface ] = None
125
- ) -> 'Metadata' :
125
+ ) -> 'Metadata' :
126
126
"""Loads JSON-formatted TUF metadata from file storage.
127
127
128
128
Arguments:
@@ -155,10 +155,10 @@ def to_dict(self) -> JsonDict:
155
155
def to_json (self , compact : bool = False ) -> None :
156
156
"""Returns the optionally compacted JSON representation of self. """
157
157
return json .dumps (
158
- self .to_dict (),
159
- indent = (None if compact else 1 ),
160
- separators = ((',' , ':' ) if compact else (',' , ': ' )),
161
- sort_keys = True )
158
+ self .to_dict (),
159
+ indent = (None if compact else 1 ),
160
+ separators = ((',' , ':' ) if compact else (',' , ': ' )),
161
+ sort_keys = True )
162
162
163
163
164
164
def to_json_file (
@@ -232,16 +232,16 @@ def verify(self, key: JsonDict) -> bool:
232
232
233
233
"""
234
234
signatures_for_keyid = list (filter (
235
- lambda sig : sig ['keyid' ] == key ['keyid' ], self .signatures ))
235
+ lambda sig : sig ['keyid' ] == key ['keyid' ], self .signatures ))
236
236
237
237
if not signatures_for_keyid :
238
238
raise tuf .exceptions .Error (
239
- f'no signature for key { key ["keyid" ]} .' )
239
+ f'no signature for key { key ["keyid" ]} .' )
240
240
241
241
if len (signatures_for_keyid ) > 1 :
242
242
raise tuf .exceptions .Error (
243
- f'{ len (signatures_for_keyid )} signatures for key '
244
- f'{ key ["keyid" ]} , not sure which one to verify.' )
243
+ f'{ len (signatures_for_keyid )} signatures for key '
244
+ f'{ key ["keyid" ]} , not sure which one to verify.' )
245
245
246
246
return verify_signature (
247
247
key , signatures_for_keyid [0 ],
@@ -293,7 +293,7 @@ def from_dict(cls, signed_dict: JsonDict) -> 'Signed':
293
293
# what the constructor expects and what we store. The inverse operation
294
294
# is implemented in 'to_dict'.
295
295
signed_dict ['expires' ] = tuf .formats .expiry_string_to_datetime (
296
- signed_dict ['expires' ])
296
+ signed_dict ['expires' ])
297
297
# NOTE: We write the converted 'expires' back into 'signed_dict' above
298
298
# so that we can pass it to the constructor as '**signed_dict' below,
299
299
# along with other fields that belong to Signed subclasses.
@@ -582,7 +582,7 @@ class Targets(Signed):
582
582
def __init__ (
583
583
self , _type : str , version : int , spec_version : str ,
584
584
expires : datetime , targets : JsonDict , delegations : JsonDict
585
- ) -> None :
585
+ ) -> None :
586
586
super ().__init__ (_type , version , spec_version , expires )
587
587
# TODO: Add class for meta
588
588
self .targets = targets
0 commit comments