@@ -300,8 +300,7 @@ def from_dict(cls, signed_dict: JsonDict) -> 'Signed':
300
300
signed_dict ['expires' ])
301
301
# NOTE: Any 'from_dict'(-like) conversions of fields that correspond
302
302
# to a subclass should be performed in the 'from_dict' method of that
303
- # subclass and also be written back into 'signed_dict' before calling
304
- # super().from_dict.
303
+ # subclass and assigned to the below returned object.
305
304
306
305
# NOTE: cls might be a subclass of Signed, if 'from_dict' was called on
307
306
# that subclass (see e.g. Metadata.from_dict).
@@ -380,6 +379,10 @@ def __init__(
380
379
self , _type : str = None , version : int = None , spec_version : str = None ,
381
380
expires : datetime = None , consistent_snapshot : bool = None ,
382
381
keys : JsonDict = None , roles : JsonDict = None ) -> None :
382
+
383
+ # TODO: Add sensible defaults when we have input validation.
384
+ # See issue https://github.com/theupdateframework/tuf/issues/1140
385
+ # We need default values to create empty objects in Signed.from_dict()
383
386
super ().__init__ (_type , version , spec_version , expires )
384
387
# TODO: Add classes for keys and roles
385
388
self .consistent_snapshot = consistent_snapshot
@@ -492,6 +495,10 @@ def __init__(
492
495
self , _type : str = None , version : int = None , spec_version : str = None ,
493
496
expires : datetime = None , meta : Dict [str , MetadataInfo ]= None
494
497
) -> None :
498
+
499
+ # TODO: Add sensible defaults when we have input validation.
500
+ # See issue https://github.com/theupdateframework/tuf/issues/1140
501
+ # We need default values to create empty objects in Signed.from_dict()
495
502
super ().__init__ (_type , version , spec_version , expires )
496
503
self .meta = meta
497
504
@@ -536,7 +543,7 @@ class Snapshot(Signed):
536
543
meta: A dictionary that contains information about targets metadata::
537
544
538
545
{
539
- 'targets.json': <MetadataInfo INSTANCE>
546
+ 'targets.json': <MetadataInfo INSTANCE>,
540
547
'<DELEGATED TARGETS ROLE 1>.json': <MetadataInfo INSTANCE>,
541
548
'<DELEGATED TARGETS ROLE 2>.json': <MetadataInfo INSTANCE>,
542
549
...
@@ -547,6 +554,10 @@ def __init__(
547
554
self , _type : str = None , version : int = None , spec_version : str = None ,
548
555
expires : datetime = None , meta : Dict [str , MetadataInfo ]= None
549
556
) -> None :
557
+
558
+ # TODO: Add sensible defaults when we have input validation.
559
+ # See issue https://github.com/theupdateframework/tuf/issues/1140
560
+ # We need default values to create empty objects in Signed.from_dict()
550
561
super ().__init__ (_type , version , spec_version , expires )
551
562
self .meta = meta
552
563
@@ -694,6 +705,9 @@ def __init__(
694
705
self , _type : str = None , version : int = None , spec_version : str = None ,
695
706
expires : datetime = None , targets : Dict [str , TargetInfo ]= None ,
696
707
delegations : JsonDict = None ) -> None :
708
+ # TODO: Add sensible defaults when we have input validation.
709
+ # See issue https://github.com/theupdateframework/tuf/issues/1140
710
+ # We need default values to create empty objects in Signed.from_dict()
697
711
super ().__init__ (_type , version , spec_version , expires )
698
712
self .targets = targets
699
713
0 commit comments