From 00d09904caad12ec71e11f4eece7ff00247a5c05 Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Wed, 11 Jul 2018 12:39:57 +0200
Subject: [PATCH] [enh] rename get_certifications_from_identities() and clarify
 with comments.

---
 silkaj/cert.py |  2 +-
 silkaj/wot.py  | 12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/silkaj/cert.py b/silkaj/cert.py
index 49acd265..cac7b105 100644
--- a/silkaj/cert.py
+++ b/silkaj/cert.py
@@ -6,7 +6,7 @@ from silkaj.tools import get_publickey_from_seed, message_exit, sign_document_fr
 from silkaj.network_tools import get_current_block, post_request
 from silkaj.license import license_approval
 from silkaj.constants import NO_MATCHING_ID
-from silkaj.wot import is_member, get_pubkeys_from_id,\
+from silkaj.wot import is_member,\
         get_uid_from_pubkey, get_searched_id
 
 
diff --git a/silkaj/wot.py b/silkaj/wot.py
index 43c6829b..87e94420 100644
--- a/silkaj/wot.py
+++ b/silkaj/wot.py
@@ -79,7 +79,7 @@ def id_pubkey_correspondence(ep, id_pubkey):
     if check_public_key(id_pubkey, False):
         print("{} public key corresponds to identity: {}".format(id_pubkey, get_uid_from_pubkey(ep, id_pubkey)))
     else:
-        pubkeys = get_pubkeys_from_id(ep, id_pubkey)
+        pubkeys = get_informations_for_identities(ep, id_pubkey)
         if pubkeys == NO_MATCHING_ID:
             print(NO_MATCHING_ID)
         else:
@@ -97,7 +97,7 @@ def get_searched_id(ep, id):
     many identities could match
     return the one searched
     """
-    certs_req = get_pubkeys_from_id(ep, id)
+    certs_req = get_informations_for_identities(ep, id)
     if certs_req == NO_MATCHING_ID:
         message_exit(NO_MATCHING_ID)
     for certs_id in certs_req:
@@ -118,12 +118,14 @@ def get_uid_from_pubkey(ep, pubkey):
         i += 1
 
 
-def get_pubkeys_from_id(ep, uid):
+def get_informations_for_identities(ep, identifier):
     """
-    check id exist
+    :identifier: identity or pubkey in part or whole
+    Return received and sent certifications lists of matching identities
+    if one identity found
     """
     try:
-        results = get_request(ep, "wot/lookup/" + uid)
+        results = get_request(ep, "wot/lookup/" + identifier)
     except:
         return NO_MATCHING_ID
     return results["results"]
-- 
GitLab