From: kaliko Date: Thu, 23 Mar 2023 16:30:33 +0000 (+0100) Subject: rtbl: Ease testing X-Git-Tag: 0.3.0~3 X-Git-Url: https://git.kaliko.me/?a=commitdiff_plain;h=6c1a29c0d63ca630a36eef61a0f38baf9f7a59a8;p=sid.git rtbl: Ease testing Make testing easier with rtbl.BL.init mapping to add testing item to the block list (locally). Generate a hash: >>> import hashlib >>> test_hash = hashlib.sha256('user@example.org'.encode('utf-8')).hexdigest() Then use it to pre-populate the block list: >>> from sid.rtbl import RTBL, BL >>> BL.init = {test_hash: 'For testing purposes'} --- diff --git a/sid/rtbl.py b/sid/rtbl.py index 0ea3bbb..b5c58cb 100644 --- a/sid/rtbl.py +++ b/sid/rtbl.py @@ -21,9 +21,11 @@ def jid_to_sha256(jid: JID) -> str: class BL: """Plain object to keep track of block list items. Only used in RTBL plugin.""" + #: Initial seed to ease testing + init = {} def __init__(self, initial_bl): - self.sha256_jids: Dict[str, Optional[str]] = {} + self.sha256_jids: Dict[str, Optional[str]] = dict(BL.init) for item in initial_bl: self.insert_item(item)