Skip to content
Snippets Groups Projects
Commit 4a8b67fb authored by Moul's avatar Moul
Browse files

[mypy] #163: Add type annotation on idty_tools

parent e2e26a38
No related branches found
No related tags found
1 merge request!214#163: Introduce mypy
......@@ -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"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment