From 8d465b22460ea24fc2c2e2ef1d1769cf60ae092b Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Sun, 5 Jun 2022 16:42:44 +0200
Subject: [PATCH] [mypy] #163: Add type annotation on membership

---
 silkaj/membership.py | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/silkaj/membership.py b/silkaj/membership.py
index c7101a1e..137f1d68 100644
--- a/silkaj/membership.py
+++ b/silkaj/membership.py
@@ -20,6 +20,7 @@ import click
 import pendulum
 from duniterpy.api import bma
 from duniterpy.documents import BlockID, Membership, get_block_id
+from duniterpy.key import SigningKey
 from tabulate import tabulate
 
 from silkaj import auth, tui, wot
@@ -35,7 +36,7 @@ from silkaj.network_tools import client_instance, send_document
 for first emission and for renewal",
 )
 @click.pass_context
-def send_membership(ctx):
+def send_membership(ctx: click.Context) -> None:
     dry_run = ctx.obj["DRY_RUN"]
 
     # Authentication
@@ -82,7 +83,9 @@ def send_membership(ctx):
     send_document(bma.blockchain.membership, membership)
 
 
-def display_confirmation_table(identity_uid, pubkey, identity_block_id):
+def display_confirmation_table(
+    identity_uid: str, pubkey: str, identity_block_id: BlockID
+) -> None:
     """
     Check whether there is pending memberships already in the mempool
     Display their expiration date
@@ -142,13 +145,13 @@ def display_confirmation_table(identity_uid, pubkey, identity_block_id):
 
 
 def generate_membership_document(
-    pubkey,
-    membership_block_id,
-    identity_uid,
-    identity_block_id,
-    currency,
-    key=None,
-):
+    pubkey: str,
+    membership_block_id: BlockID,
+    identity_uid: str,
+    identity_block_id: BlockID,
+    currency: str,
+    key: SigningKey = None,
+) -> Membership:
     return Membership(
         issuer=pubkey,
         membership_block_id=membership_block_id,
-- 
GitLab