From ccbac96f9a76d7808160e369be253ea70ce72d59 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 1 Nov 2023 17:35:45 +0000 Subject: [PATCH] (trivial) contacts: add some type hints --- electrum/contacts.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/electrum/contacts.py b/electrum/contacts.py index 6630dd502..019d0964d 100644 --- a/electrum/contacts.py +++ b/electrum/contacts.py @@ -21,7 +21,7 @@ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import re -from typing import Optional, Tuple, Dict, Any +from typing import Optional, Tuple, Dict, Any, TYPE_CHECKING import dns import threading @@ -33,6 +33,10 @@ from .util import read_json_file, write_json_file, to_string from .logging import Logger, get_logger from .util import trigger_callback +if TYPE_CHECKING: + from .wallet_db import WalletDB + from .simple_config import SimpleConfig + _logger = get_logger(__name__) @@ -43,7 +47,7 @@ class AliasNotFoundException(Exception): class Contacts(dict, Logger): - def __init__(self, db): + def __init__(self, db: 'WalletDB'): Logger.__init__(self) self.db = db d = self.db.get('contacts', {}) @@ -121,7 +125,7 @@ class Contacts(dict, Logger): } return None - def fetch_openalias(self, config): + def fetch_openalias(self, config: 'SimpleConfig'): self.alias_info = None alias = config.OPENALIAS_ID if alias: