From bcc46437534bbd6afb849204768cfefcbf64818c Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Tue, 19 Mar 2019 22:08:33 +0100
Subject: [PATCH] =?UTF-8?q?[mod]=20#157:=20get=5Fuid=5Ffrom=5Fpubkey():?=
 =?UTF-8?q?=C2=A0use=20for=20x=20in=20y:?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 silkaj/wot.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/silkaj/wot.py b/silkaj/wot.py
index fa8fe2f7..6270f71a 100644
--- a/silkaj/wot.py
+++ b/silkaj/wot.py
@@ -196,14 +196,12 @@ async def get_informations_for_identity(id):
 async def get_uid_from_pubkey(pubkey):
     try:
         client = ClientInstance().client
-        results = await client(wot.lookup, pubkey)
+        lookups = await client(wot.lookup, pubkey)
     except:
         return NO_MATCHING_ID
-    i, results = 0, results["results"]
-    while i < len(results):
-        if results[i]["uids"][0]["uid"] != pubkey:
-            return results[i]["uids"][0]["uid"]
-        i += 1
+    for lookup in lookups["results"]:
+        if lookup["uids"][0]["uid"] != pubkey:
+            return lookup["uids"][0]["uid"]
 
 
 async def get_informations_for_identities(identifier):
-- 
GitLab