From 4a8b67fb5ee657f28fae2fea7908cbc34547bc3e Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Sun, 5 Jun 2022 16:42:42 +0200 Subject: [PATCH] [mypy] #163: Add type annotation on idty_tools --- silkaj/idty_tools.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/silkaj/idty_tools.py b/silkaj/idty_tools.py index 42c7934c..2f844aec 100644 --- a/silkaj/idty_tools.py +++ b/silkaj/idty_tools.py @@ -16,7 +16,7 @@ import shutil import sys import urllib -from typing import Union +from typing import List, Union import click import pendulum @@ -30,7 +30,7 @@ from silkaj.network_tools import client_instance from silkaj.tui import gen_pubkey_checksum -def display_identity(idty: Identity): +def display_identity(idty: Identity) -> Texttable: """ Creates a table containing the identity infos """ @@ -50,7 +50,7 @@ def display_identity(idty: Identity): return table -def check_many_identities(document: Union[Identity, Revocation]): +def check_many_identities(document: Union[Identity, Revocation]) -> bool: """ Checks if many identities match the one looked after. Returns True if the same identity is found, False if not. @@ -86,7 +86,7 @@ def check_many_identities(document: Union[Identity, Revocation]): return False -def display_alternate_ids(ids_list: list): +def display_alternate_ids(ids_list: List) -> Texttable: labels = ["uid", "public key", "timestamp"] table = Texttable(max_width=shutil.get_terminal_size().columns) table.header(labels) @@ -95,7 +95,7 @@ def display_alternate_ids(ids_list: list): return table -def merge_ids_lists(lookups_pubkey: list, lookups_uid: list, currency: str): +def merge_ids_lists(lookups_pubkey: List, lookups_uid: List, currency: str) -> List: """ merge two lists of identities and remove duplicate identities. """ @@ -113,7 +113,7 @@ def merge_ids_lists(lookups_pubkey: list, lookups_uid: list, currency: str): return ids -def ids_list_from_lookups(lookups: list, currency: str): +def ids_list_from_lookups(lookups: List, currency: str) -> List: ids = list() for lookup in lookups: pubkey = lookup["pubkey"] -- GitLab