mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-07-01 18:56:40 +00:00
fixed option 4 removing local instance rows
This commit is contained in:
parent
bc4d6f3af0
commit
50f6a637cd
2 changed files with 33 additions and 6 deletions
|
@ -305,6 +305,26 @@ def is_row_valid(row):
|
|||
|
||||
###################### General ######################
|
||||
|
||||
def renew_csv(df, participant_url):
|
||||
"""
|
||||
Removes all rows that are not generated by the local instance
|
||||
|
||||
Parameters
|
||||
----------
|
||||
df : pd.DataFrame
|
||||
Dataframe we want to renew
|
||||
participant_url : str
|
||||
the instance url
|
||||
|
||||
Returns:
|
||||
--------
|
||||
pd.DataFrame
|
||||
The renewed dataframe
|
||||
"""
|
||||
|
||||
return df[df['Instance'] == participant_url]
|
||||
|
||||
|
||||
def merge_verification_df(receiving_df, merging_df):
|
||||
"""
|
||||
Merges 2 dataframes of type verified or unverified (do not merge duplications by name or url)
|
||||
|
@ -775,10 +795,15 @@ def get_local_verified_and_unverified():
|
|||
|
||||
return pd.DataFrame(), pd.DataFrame()
|
||||
|
||||
def get_local_webring_participants():
|
||||
def get_local_webring_participants(current_instance):
|
||||
"""
|
||||
Make sure the official participants are registered in the webring csv file
|
||||
|
||||
Parameters
|
||||
----------
|
||||
current_instance : str
|
||||
The current local instance url
|
||||
|
||||
Returns
|
||||
-------
|
||||
pd.DataFrame
|
||||
|
@ -792,7 +817,9 @@ def get_local_webring_participants():
|
|||
missing_participants = set(get_official_participants()) - set(webring_df['URL'])
|
||||
|
||||
for participant in missing_participants:
|
||||
new_row = [{'Name': '','URL': participant,'Description': '','Trusted': 'NO','Status': '','Score': ''}]
|
||||
if participant == current_instance:
|
||||
continue
|
||||
new_row = [{'Name': '','URL': participant,'Description': '','Trusted': 'NO','Status': '','Score': '', 'Blacklisted': 'NO'}]
|
||||
webring_df = pd.concat([webring_df, pd.DataFrame(new_row)], ignore_index=True)
|
||||
|
||||
save_dataframe(webring_df, conf.LOCAL_DIR + conf.WEBRING_CSV_FILE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue