Skip to content

Commit

Permalink
Don't use Mapping for mutable dicts
Browse files Browse the repository at this point in the history
Stop using Mapping where we actually mean Dict:
Mapping means "we only need a read-only dict" and most of the time
this is not really the case.

Additionally, fix one type hint where I forgot to add "Dict".

Signed-off-by: Martin Vrachev <mvrachev@vmware.com>
  • Loading branch information
MVrachev committed May 11, 2021
1 parent 10a8faa commit 9815917
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tuf/api/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def __init__(
self.unrecognized_fields = unrecognized_fields or {}

@classmethod
def from_dict(cls, delegations_dict: Mapping[str, Any]) -> "Delegations":
def from_dict(cls, delegations_dict: Dict[str, Any]) -> "Delegations":
"""Creates Delegations object from its dict representation."""
keys = delegations_dict.pop("keys")
keys_res = {}
Expand Down Expand Up @@ -900,7 +900,7 @@ def __init__(
spec_version: str,
expires: datetime,
targets: Mapping[str, Any],
delegations: Optional[Delegations] = None,
delegations: Optional[Dict[Delegations]] = None,
unrecognized_fields: Optional[Mapping[str, Any]] = None,
) -> None:
super().__init__(version, spec_version, expires, unrecognized_fields)
Expand Down

0 comments on commit 9815917

Please sign in to comment.