Skip to content

Commit f2e80a8

Browse files
author
Lukas Pühringer
authored
Merge pull request #1843 from ivanayov/metadata_docstrings_imprv_follow_up
Improve docstrings in Metadata API to be more descriptive
2 parents 9c8622d + e71aa4a commit f2e80a8

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

tuf/api/metadata.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def __eq__(self, other: Any) -> bool:
141141

142142
@classmethod
143143
def from_dict(cls, metadata: Dict[str, Any]) -> "Metadata[T]":
144-
"""Creates ``Metadata`` object from its dict representation.
144+
"""Creates ``Metadata`` object from its json/dict representation.
145145
146146
Args:
147147
metadata: TUF metadata in dict representation.
@@ -335,7 +335,9 @@ def sign(
335335
"""Creates signature over ``signed`` and assigns it to ``signatures``.
336336
337337
Args:
338-
signer: A securesystemslib.signer.Signer implementation.
338+
signer: A ``securesystemslib.signer.Signer`` object that provides a private
339+
key and signing implementation to generate the signature. A standard
340+
implementation is available in ``securesystemslib.signer.SSlibSigner``.
339341
append: ``True`` if the signature should be appended to
340342
the list of signatures or replace any existing signatures. The
341343
default behavior is to replace signatures.
@@ -522,7 +524,7 @@ def to_dict(self) -> Dict[str, Any]:
522524
@classmethod
523525
@abc.abstractmethod
524526
def from_dict(cls, signed_dict: Dict[str, Any]) -> "Signed":
525-
"""Deserialization helper, creates object from dict representation"""
527+
"""Deserialization helper, creates object from json/dict representation"""
526528
raise NotImplementedError
527529

528530
@classmethod
@@ -636,7 +638,7 @@ def __eq__(self, other: Any) -> bool:
636638

637639
@classmethod
638640
def from_dict(cls, keyid: str, key_dict: Dict[str, Any]) -> "Key":
639-
"""Creates ``Key`` object from its dict representation.
641+
"""Creates ``Key`` object from its json/dict representation.
640642
641643
Raises:
642644
KeyError, TypeError: Invalid arguments.
@@ -667,7 +669,7 @@ def to_securesystemslib_key(self) -> Dict[str, Any]:
667669

668670
@classmethod
669671
def from_securesystemslib_key(cls, key_dict: Dict[str, Any]) -> "Key":
670-
"""Creates a ``Key`` object from a securesystemlib key dict representation
672+
"""Creates a ``Key`` object from a securesystemlib key json/dict representation
671673
removing the private key from keyval.
672674
673675
Args:
@@ -790,7 +792,7 @@ def __eq__(self, other: Any) -> bool:
790792

791793
@classmethod
792794
def from_dict(cls, role_dict: Dict[str, Any]) -> "Role":
793-
"""Creates ``Role`` object from its dict representation.
795+
"""Creates ``Role`` object from its json/dict representation.
794796
795797
Raises:
796798
ValueError, KeyError: Invalid arguments.
@@ -863,7 +865,7 @@ def __eq__(self, other: Any) -> bool:
863865

864866
@classmethod
865867
def from_dict(cls, signed_dict: Dict[str, Any]) -> "Root":
866-
"""Creates ``Root`` object from its dict representation.
868+
"""Creates ``Root`` object from its json/dict representation.
867869
868870
Raises:
869871
ValueError, KeyError, TypeError: Invalid arguments.
@@ -1056,7 +1058,7 @@ def __eq__(self, other: Any) -> bool:
10561058

10571059
@classmethod
10581060
def from_dict(cls, meta_dict: Dict[str, Any]) -> "MetaFile":
1059-
"""Creates ``MetaFile`` object from its dict representation.
1061+
"""Creates ``MetaFile`` object from its json/dict representation.
10601062
10611063
Raises:
10621064
ValueError, KeyError: Invalid arguments.
@@ -1144,7 +1146,7 @@ def __eq__(self, other: Any) -> bool:
11441146

11451147
@classmethod
11461148
def from_dict(cls, signed_dict: Dict[str, Any]) -> "Timestamp":
1147-
"""Creates ``Timestamp`` object from its dict representation.
1149+
"""Creates ``Timestamp`` object from its json/dict representation.
11481150
11491151
Raises:
11501152
ValueError, KeyError: Invalid arguments.
@@ -1203,7 +1205,7 @@ def __eq__(self, other: Any) -> bool:
12031205

12041206
@classmethod
12051207
def from_dict(cls, signed_dict: Dict[str, Any]) -> "Snapshot":
1206-
"""Creates ``Snapshot`` object from its dict representation.
1208+
"""Creates ``Snapshot`` object from its json/dict representation.
12071209
12081210
Raises:
12091211
ValueError, KeyError: Invalid arguments.
@@ -1299,7 +1301,7 @@ def __eq__(self, other: Any) -> bool:
12991301

13001302
@classmethod
13011303
def from_dict(cls, role_dict: Dict[str, Any]) -> "DelegatedRole":
1302-
"""Creates ``DelegatedRole`` object from its dict representation.
1304+
"""Creates ``DelegatedRole`` object from its json/dict representation.
13031305
13041306
Raises:
13051307
ValueError, KeyError: Invalid arguments.
@@ -1439,7 +1441,7 @@ def __eq__(self, other: Any) -> bool:
14391441

14401442
@classmethod
14411443
def from_dict(cls, delegations_dict: Dict[str, Any]) -> "Delegations":
1442-
"""Creates ``Delegations`` object from its dict representation.
1444+
"""Creates ``Delegations`` object from its json/dict representation.
14431445
14441446
Raises:
14451447
ValueError, KeyError, TypeError: Invalid arguments.
@@ -1522,7 +1524,7 @@ def __eq__(self, other: Any) -> bool:
15221524

15231525
@classmethod
15241526
def from_dict(cls, target_dict: Dict[str, Any], path: str) -> "TargetFile":
1525-
"""Creates ``TargetFile`` object from its dict representation.
1527+
"""Creates ``TargetFile`` object from its json/dict representation.
15261528
15271529
Raises:
15281530
ValueError, KeyError, TypeError: Invalid arguments.
@@ -1679,7 +1681,7 @@ def __eq__(self, other: Any) -> bool:
16791681

16801682
@classmethod
16811683
def from_dict(cls, signed_dict: Dict[str, Any]) -> "Targets":
1682-
"""Creates ``Targets`` object from its dict representation.
1684+
"""Creates ``Targets`` object from its json/dict representation.
16831685
16841686
Raises:
16851687
ValueError, KeyError, TypeError: Invalid arguments.

0 commit comments

Comments
 (0)