Yet more debugging

Trying to find how to thread stuff is harder than I thought it would be. Where's the root?
This commit is contained in:
autocommit 2020-06-01 02:01:25 +00:00 committed by Cy
parent d08d32c11c
commit be49ed879e
No known key found for this signature in database
GPG Key ID: F66D599380F88521
1 changed files with 11 additions and 12 deletions

View File

@ -4,23 +4,22 @@ def maketree(descendants):
lookup = dict((descendant.id, descendant) for descendant in descendants)
replies = {}
roots = set()
def getreps(id):
if id in replies:
reps = replies[id]
else:
reps = set()
replies[id] = reps
return reps
for descendant in descendants:
if not descendant.in_reply_to_id:
roots.add(descendant.id)
print("ROOT", descendant.id, descendant.account.id, descendant.account.acct)
elif descendant.in_reply_to_id in replies:
reps = replies[descendant.in_reply_to_id]
reps.add(descendant.id)
print("REPLY", descendant.id,
descendant.in_reply_to_id,
descendant.in_reply_to_account_id,
descendant.in_reply_to_id in lookup)
else:
reps = set()
print("NEWREPLY", descendant.id,
descendant.in_reply_to_id,
descendant.in_reply_to_id in lookup)
replies[descendant.in_reply_to_id] = set([descendant.id])
reps = getreps(descendant.in_reply_to_id)
reps.add(descendant.id)
reps = getreps(descendant.in_reply_to_account_id)
reps.add(descendant.id)
seen = set()
def onelevel(reps):
for rep in reps: