mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-09-29 09:53:17 +02:00
consider multiple keys as source for wot
This commit is contained in:
@@ -18,7 +18,7 @@ from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
|||||||
from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88
|
from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag, create_amount_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag, create_amount_tag
|
||||||
from nostr_dvm.utils.output_utils import post_process_list_to_events
|
from nostr_dvm.utils.output_utils import post_process_list_to_events
|
||||||
from nostr_dvm.utils.wot_utils import build_network_from, save_network, print_results
|
from nostr_dvm.utils.wot_utils import build_wot_network, save_network, print_results
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This File contains a Module to update the database for content discovery dvms
|
This File contains a Module to update the database for content discovery dvms
|
||||||
@@ -147,12 +147,9 @@ class DicoverContentDBUpdateScheduler(DVMTaskInterface):
|
|||||||
|
|
||||||
|
|
||||||
if self.dvm_config.WOT_FILTERING:
|
if self.dvm_config.WOT_FILTERING:
|
||||||
user = self.dvm_config.WOT_BASED_ON_NPUB
|
print("Calculating WOT for " + str(self.dvm_config.WOT_BASED_ON_NPUBS))
|
||||||
depth = self.dvm_config.WOT_DEPTH
|
|
||||||
print("Calculating WOT for " + user)
|
|
||||||
|
|
||||||
filtering = cli.filtering()
|
filtering = cli.filtering()
|
||||||
index_map, G = await build_network_from(user, depth=depth, max_batch=500, max_time_request=10)
|
index_map, G = await build_wot_network(self.dvm_config.WOT_BASED_ON_NPUBS, depth=self.dvm_config.WOT_DEPTH, max_batch=500, max_time_request=10)
|
||||||
|
|
||||||
# Do we actually need pagerank here?
|
# Do we actually need pagerank here?
|
||||||
#print('computing global pagerank...')
|
#print('computing global pagerank...')
|
||||||
|
@@ -19,7 +19,7 @@ from nostr_dvm.utils.dvmconfig import DVMConfig, build_default_config
|
|||||||
from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88
|
from nostr_dvm.utils.nip88_utils import NIP88Config, check_and_set_d_tag_nip88, check_and_set_tiereventid_nip88
|
||||||
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag, create_amount_tag
|
from nostr_dvm.utils.nip89_utils import NIP89Config, check_and_set_d_tag, create_amount_tag
|
||||||
from nostr_dvm.utils.output_utils import post_process_list_to_events, post_process_list_to_users
|
from nostr_dvm.utils.output_utils import post_process_list_to_events, post_process_list_to_users
|
||||||
from nostr_dvm.utils.wot_utils import build_network_from, save_network, load_network, print_results, \
|
from nostr_dvm.utils.wot_utils import build_wot_network, save_network, load_network, print_results, \
|
||||||
convert_index_to_hex
|
convert_index_to_hex
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -141,7 +141,7 @@ class DiscoverPeopleMyWOT(DVMTaskInterface):
|
|||||||
#hop1
|
#hop1
|
||||||
user_id = PublicKey.parse(options["user"]).to_hex()
|
user_id = PublicKey.parse(options["user"]).to_hex()
|
||||||
|
|
||||||
index_map, G = await build_network_from(options["user"], depth=int(options["hops"]), max_batch=500, max_time_request=10)
|
index_map, G = await build_wot_network(options["user"], depth=int(options["hops"]), max_batch=500, max_time_request=10)
|
||||||
if use_files:
|
if use_files:
|
||||||
save_network(index_map, G, options["user"])
|
save_network(index_map, G, options["user"])
|
||||||
|
|
||||||
|
@@ -25,7 +25,10 @@ class DVMConfig:
|
|||||||
|
|
||||||
# Straight Censorship (reply guy spam)
|
# Straight Censorship (reply guy spam)
|
||||||
WOT_FILTERING = False
|
WOT_FILTERING = False
|
||||||
WOT_BASED_ON_NPUB = "99bb5591c9116600f845107d31f9b59e2f7c7e09a1ff802e84f1d43da557ca64"
|
WOT_BASED_ON_NPUBS = ["99bb5591c9116600f845107d31f9b59e2f7c7e09a1ff802e84f1d43da557ca64",
|
||||||
|
"460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c",
|
||||||
|
"3f770d65d3a764a9c5cb503ae123e62ec7598ad035d836e2a810f3877a745b24"
|
||||||
|
]
|
||||||
WOT_DEPTH = 2
|
WOT_DEPTH = 2
|
||||||
|
|
||||||
|
|
||||||
|
@@ -93,7 +93,7 @@ async def get_following(pks, max_time_request=10, newer_than_time=None):
|
|||||||
return following
|
return following
|
||||||
|
|
||||||
|
|
||||||
async def build_network_from(seed_pks, depth=2, max_batch=500, max_time_request=10):
|
async def build_wot_network(seed_pks, depth=2, max_batch=500, max_time_request=10):
|
||||||
if not seed_pks:
|
if not seed_pks:
|
||||||
print('Error: seed_pks cannot be empty')
|
print('Error: seed_pks cannot be empty')
|
||||||
return
|
return
|
||||||
@@ -636,5 +636,5 @@ async def convert_index_to_hex(graph, index_map, show_results_num):
|
|||||||
def test():
|
def test():
|
||||||
# WARNING, DEPENDING ON DEPTH THIS TAKES LONG
|
# WARNING, DEPENDING ON DEPTH THIS TAKES LONG
|
||||||
user = '3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d'
|
user = '3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d'
|
||||||
index_map, network_graph = asyncio.run(build_network_from(user, depth=2, max_batch=500, max_time_request=10))
|
index_map, network_graph = asyncio.run(build_wot_network(user, depth=2, max_batch=500, max_time_request=10))
|
||||||
save_network(index_map, network_graph, user)
|
save_network(index_map, network_graph, user)
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# Imports\n",
|
"# Imports\n",
|
||||||
"from nostr_dvm.utils.wot_utils import build_network_from, save_network, load_network, get_mc_pagerank, get_subrank, get_metadata, print_results\n",
|
"from nostr_dvm.utils.wot_utils import build_wot_network, save_network, load_network, get_mc_pagerank, get_subrank, get_metadata, print_results\n",
|
||||||
"import time\n",
|
"import time\n",
|
||||||
"import networkx as nx\n",
|
"import networkx as nx\n",
|
||||||
"import random\n",
|
"import random\n",
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"index_map, G = await build_network_from(user, depth=2, max_batch=500, max_time_request=10)\n",
|
"index_map, G = await build_wot_network(user, depth=2, max_batch=500, max_time_request=10)\n",
|
||||||
"if use_files:\n",
|
"if use_files:\n",
|
||||||
" save_network(index_map, G, user)"
|
" save_network(index_map, G, user)"
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user