diff --git a/silkaj/wot_tools.py b/silkaj/wot_tools.py index 13281dee12e79882d59720853dccc0b2d51ee574..f92c81b58133cd1a3a3328ab68fe3c972e106587 100644 --- a/silkaj/wot_tools.py +++ b/silkaj/wot_tools.py @@ -13,12 +13,14 @@ # You should have received a copy of the GNU Affero General Public License # along with Silkaj. If not, see <https://www.gnu.org/licenses/>. +from typing import Dict, List, Optional + from duniterpy.api.bma import wot from silkaj.network_tools import client_instance -def identity_of(pubkey_uid): +def identity_of(pubkey_uid: str) -> Dict: """ Only works for members Not able to get corresponding uid from a non-member identity @@ -31,7 +33,7 @@ def identity_of(pubkey_uid): pass -def is_member(pubkey_uid): +def is_member(pubkey_uid: str) -> Optional[Dict]: """ Check identity is member If member, return corresponding identity, else: False @@ -39,10 +41,10 @@ def is_member(pubkey_uid): try: return identity_of(pubkey_uid) except Exception: - return False + return None -def wot_lookup(identifier): +def wot_lookup(identifier: str) -> List: """ :identifier: identity or pubkey in part or whole Return received and sent certifications lists of matching identities @@ -52,7 +54,7 @@ def wot_lookup(identifier): return (client(wot.lookup, identifier))["results"] -def identities_from_pubkeys(pubkeys, uids): +def identities_from_pubkeys(pubkeys: List[str], uids: bool) -> List: """ Make list of pubkeys unique, and remove empty strings Request identities