Add type hints to peer folder

This commit is contained in:
NIC619
2019-07-27 16:27:01 +08:00
parent b695b0e1ec
commit f2de986c74
10 changed files with 165 additions and 87 deletions

View File

@ -1,13 +1,20 @@
from abc import ABC, abstractmethod
from typing import (
Any,
)
from .id import (
ID,
)
class IPeerMetadata(ABC):
def __init__(self):
def __init__(self) -> None:
pass
@abstractmethod
def get(self, peer_id, key):
def get(self, peer_id: ID, key: Any) -> Any:
"""
:param peer_id: peer ID to lookup key for
:param key: key to look up
@ -16,7 +23,7 @@ class IPeerMetadata(ABC):
"""
@abstractmethod
def put(self, peer_id, key, val):
def put(self, peer_id: ID, key: Any, val: Any) -> None:
"""
:param peer_id: peer ID to lookup key for
:param key: key to associate with peer