From 24f2f70d1cbab50355c02599bc4bb65967260777 Mon Sep 17 00:00:00 2001 From: dbth <1097224+believethehype@users.noreply.github.com> Date: Mon, 30 Dec 2024 23:04:14 +0100 Subject: [PATCH] fix circular import --- nostr_dvm/utils/nip65_utils.py | 20 ++++++++++---------- nostr_dvm/utils/nip89_utils.py | 8 +++----- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/nostr_dvm/utils/nip65_utils.py b/nostr_dvm/utils/nip65_utils.py index de69aa2..e4a124e 100644 --- a/nostr_dvm/utils/nip65_utils.py +++ b/nostr_dvm/utils/nip65_utils.py @@ -1,20 +1,20 @@ from nostr_sdk import Tag, Keys, EventBuilder, Kind from nostr_dvm.utils.definitions import EventDefinitions -from nostr_dvm.utils.dvmconfig import DVMConfig from nostr_dvm.utils.nostr_utils import send_event from nostr_dvm.utils.print_utils import bcolors async def announce_dm_relays(dvm_config, client): tags = [] - relays_to_publish = DVMConfig.ANNOUNCE_RELAY_LIST + RELAY_LIST = dvm_config.ANNOUNCE_RELAY_LIST for relay in dvm_config.RELAY_LIST: - if relay not in relays_to_publish: - relays_to_publish.append(relay) + if relay not in RELAY_LIST: + RELAY_LIST.append(relay) - for relay in relays_to_publish: + dvm_config.RELAY_LIST = RELAY_LIST + for relay in RELAY_LIST: r_tag = Tag.parse(["r", relay]) tags.append(r_tag) @@ -38,14 +38,14 @@ async def nip65_announce_relays(dvm_config, client): tags = [] - relays_to_publish = DVMConfig.ANNOUNCE_RELAY_LIST - + RELAY_LIST = dvm_config.ANNOUNCE_RELAY_LIST for relay in dvm_config.RELAY_LIST: - if relay not in relays_to_publish: - relays_to_publish.append(relay) + if relay not in RELAY_LIST: + RELAY_LIST.append(relay) + dvm_config.RELAY_LIST = RELAY_LIST - for relay in relays_to_publish: + for relay in RELAY_LIST: r_tag = Tag.parse(["r", relay]) tags.append(r_tag) diff --git a/nostr_dvm/utils/nip89_utils.py b/nostr_dvm/utils/nip89_utils.py index 49cf3db..fb59187 100644 --- a/nostr_dvm/utils/nip89_utils.py +++ b/nostr_dvm/utils/nip89_utils.py @@ -6,7 +6,6 @@ import dotenv from nostr_sdk import Tag, Keys, EventBuilder, Filter, Alphabet, PublicKey, Client, EventId, SingleLetterTag, Kind from nostr_dvm.utils.definitions import EventDefinitions, relay_timeout -from nostr_dvm.utils.dvmconfig import DVMConfig from nostr_dvm.utils.nostr_utils import send_event from nostr_dvm.utils.print_utils import bcolors @@ -32,11 +31,10 @@ async def nip89_announce_tasks(dvm_config, client): content = dvm_config.NIP89.CONTENT event = EventBuilder(EventDefinitions.KIND_ANNOUNCEMENT, content).tags([k_tag, d_tag]).sign_with_keys(keys) - new_dvm_config = DVMConfig() - new_dvm_config.RELAY_LIST = new_dvm_config.ANNOUNCE_RELAY_LIST + RELAY_LIST = dvm_config.ANNOUNCE_RELAY_LIST for relay in dvm_config.RELAY_LIST: - if relay not in new_dvm_config.RELAY_LIST: - new_dvm_config.RELAY_LIST.append(relay) + if relay not in RELAY_LIST: + dvm_config.RELAY_LIST.append(relay) eventid = await send_event(event, client=client, dvm_config=dvm_config) print(