33
44"""Repository Abstraction for metadata management"""
55
6- from copy import deepcopy
76import logging
87from abc import ABC , abstractmethod
98from contextlib import contextmanager , suppress
9+ from copy import deepcopy
1010from typing import Dict , Generator , Optional , Tuple
1111
1212from tuf .api .metadata import Metadata , MetaFile , Signed
@@ -132,7 +132,8 @@ def snapshot(self, force: bool = False) -> Tuple[bool, Dict[str, MetaFile]]:
132132 raise AbortEdit ("Skip snapshot: No targets version changes" )
133133
134134 if not update_version :
135- logger .debug ("Snapshot update not needed" )
135+ # this is reachable as edit() handles AbortEdit
136+ logger .debug ("Snapshot update not needed" ) # type: ignore[unreachable]
136137 else :
137138 logger .debug (
138139 "Snapshot v%d, %d targets" , snapshot .version , len (snapshot .meta )
@@ -153,7 +154,7 @@ def timestamp(self, force: bool = False) -> Tuple[bool, Optional[MetaFile]]:
153154 removed = None
154155 with self .edit ("timestamp" ) as timestamp :
155156 if self .snapshot_info .version < timestamp .snapshot_meta .version :
156- raise ValueError (f "snapshot version rollback" )
157+ raise ValueError ("snapshot version rollback" )
157158
158159 if self .snapshot_info .version > timestamp .snapshot_meta .version :
159160 update_version = True
@@ -164,7 +165,8 @@ def timestamp(self, force: bool = False) -> Tuple[bool, Optional[MetaFile]]:
164165 raise AbortEdit ("Skip timestamp: No snapshot version changes" )
165166
166167 if not update_version :
167- logger .debug ("Timestamp update not needed" )
168+ # this is reachable as edit() handles AbortEdit
169+ logger .debug ("Timestamp update not needed" ) # type: ignore[unreachable]
168170 else :
169171 logger .debug ("Timestamp v%d" , timestamp .version )
170172 return update_version , removed
0 commit comments