Skip to content
Snippets Groups Projects
Commit 8cda9595 authored by Moul's avatar Moul
Browse files

[mypy] #163: Add type annotation on tui

parent f528e44c
No related branches found
No related tags found
1 merge request!214#163: Introduce mypy
......@@ -14,6 +14,7 @@
# along with Silkaj. If not, see <https://www.gnu.org/licenses/>.
import sys
from typing import List, Optional
import click
......@@ -22,7 +23,9 @@ from silkaj import crypto_tools as ct
from silkaj import wot_tools
def display_amount(tx, message, amount, ud_value, currency_symbol):
def display_amount(
tx: List, message: str, amount: float, ud_value: float, currency_symbol: str
) -> None:
"""
Displays an amount in unit and relative reference.
"""
......@@ -36,7 +39,7 @@ def display_amount(tx, message, amount, ud_value, currency_symbol):
)
def display_pubkey(tx, message, pubkey):
def display_pubkey(tx: List, message: str, pubkey: str) -> None:
"""
Displays a pubkey and the eventually associated id.
"""
......@@ -46,7 +49,11 @@ def display_pubkey(tx, message, pubkey):
tx.append([f"{message} (id)", id["uid"]])
def gen_pubkey_checksum(pubkey, short=False, length=constants.SHORT_PUBKEY_SIZE):
def gen_pubkey_checksum(
pubkey: str,
short: Optional[bool] = False,
length: Optional[int] = constants.SHORT_PUBKEY_SIZE,
) -> str:
"""
Returns "<pubkey>:<checksum>" in full form.
returns `length` first chars of pubkey and checksum in short form.
......@@ -56,6 +63,6 @@ def gen_pubkey_checksum(pubkey, short=False, length=constants.SHORT_PUBKEY_SIZE)
return f"{short_pubkey}:{ct.gen_checksum(pubkey)}"
def send_doc_confirmation(document_name):
def send_doc_confirmation(document_name: str) -> None:
if not click.confirm(f"Do you confirm sending this {document_name}?"):
sys.exit(constants.SUCCESS_EXIT_STATUS)
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