2828from collections import OrderedDict
2929from datetime import datetime , timedelta
3030from pathlib import Path
31+ from typing import Any , Dict
3132
3233from securesystemslib .keys import generate_ed25519_key
3334from securesystemslib .signer import SSlibSigner
4849from tuf .api .serialization .json import JSONSerializer
4950
5051
51- def _in (days ) :
52+ def _in (days : float ) -> datetime :
5253 """Adds 'days' to now and returns datetime object w/o microseconds."""
5354 return datetime .utcnow ().replace (microsecond = 0 ) + timedelta (days = days )
5455
@@ -89,8 +90,8 @@ def _in(days):
8990
9091# Define containers for role objects and cryptographic keys created below. This
9192# allows us to sign and write metadata in a batch more easily.
92- roles = {}
93- keys = {}
93+ roles : Dict [ str , Metadata ] = {}
94+ keys : Dict [ str , Dict [ str , Any ]] = {}
9495
9596
9697# Targets (integrity)
@@ -117,7 +118,7 @@ def _in(days):
117118local_path = Path (__file__ ).resolve ()
118119target_path = f"{ local_path .parts [- 2 ]} /{ local_path .parts [- 1 ]} "
119120
120- target_file_info = TargetFile .from_file (target_path , local_path )
121+ target_file_info = TargetFile .from_file (target_path , str ( local_path ) )
121122roles ["targets" ].signed .targets [target_path ] = target_file_info
122123
123124# Snapshot (consistency)
@@ -332,7 +333,7 @@ def _in(days):
332333del roles ["targets" ].signed .targets [target_path ]
333334
334335# Increase expiry (delegators should be less volatile)
335- roles ["targets" ].expires = _in (365 )
336+ roles ["targets" ].signed . expires = _in (365 )
336337
337338
338339# Snapshot + Timestamp + Sign + Persist
0 commit comments