Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions requirements/lint.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# Lint tools
# (We are not so interested in the specific versions of the tools: the versions
# are pinned to prevent unexpected linting failures when tools update)
ruff==0.9.10
ruff==0.11.0
mypy==1.15.0
zizmor==1.4.1
zizmor==1.5.1

# Required for type stubs
freezegun==1.5.1
4 changes: 2 additions & 2 deletions tuf/api/dsse.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def from_bytes(cls, data: bytes) -> SimpleEnvelope[T]:
except Exception as e:
raise DeserializationError from e

return cast(SimpleEnvelope[T], envelope)
return cast("SimpleEnvelope[T]", envelope)

def to_bytes(self) -> bytes:
"""Return envelope as JSON bytes.
Expand Down Expand Up @@ -150,4 +150,4 @@ def get_signed(self) -> T:
except Exception as e:
raise DeserializationError from e

return cast(T, inner_cls.from_dict(payload_dict))
return cast("T", inner_cls.from_dict(payload_dict))
2 changes: 1 addition & 1 deletion tuf/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def from_dict(cls, metadata: dict[str, Any]) -> Metadata[T]:

return cls(
# Specific type T is not known at static type check time: use cast
signed=cast(T, inner_cls.from_dict(metadata.pop("signed"))),
signed=cast("T", inner_cls.from_dict(metadata.pop("signed"))),
signatures=signatures,
# All fields left in the metadata dict are unrecognized.
unrecognized_fields=metadata,
Expand Down
8 changes: 4 additions & 4 deletions tuf/ngclient/_internal/trusted_metadata_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,22 @@ def __iter__(self) -> Iterator[Signed]:
@property
def root(self) -> Root:
"""Get current root."""
return cast(Root, self._trusted_set[Root.type])
return cast("Root", self._trusted_set[Root.type])

@property
def timestamp(self) -> Timestamp:
"""Get current timestamp."""
return cast(Timestamp, self._trusted_set[Timestamp.type])
return cast("Timestamp", self._trusted_set[Timestamp.type])

@property
def snapshot(self) -> Snapshot:
"""Get current snapshot."""
return cast(Snapshot, self._trusted_set[Snapshot.type])
return cast("Snapshot", self._trusted_set[Snapshot.type])

@property
def targets(self) -> Targets:
"""Get current top-level targets."""
return cast(Targets, self._trusted_set[Targets.type])
return cast("Targets", self._trusted_set[Targets.type])

# Methods for updating metadata
def update_root(self, data: bytes) -> Root:
Expand Down
2 changes: 1 addition & 1 deletion tuf/ngclient/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def _load_targets(self, role: str, parent_role: str) -> Targets:

# Avoid loading 'role' more than once during "get_targetinfo"
if role in self._trusted_set:
return cast(Targets, self._trusted_set[role])
return cast("Targets", self._trusted_set[role])

try:
data = self._load_local_metadata(role)
Expand Down