From 67bea0768ba1e20c032cbf33b02c69eaae26c4f8 Mon Sep 17 00:00:00 2001 From: Ayo Ayco Date: Fri, 19 Apr 2024 20:15:55 +0200 Subject: [PATCH] refactor: no check for descendants in clean_status --- app.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app.py b/app.py index e42178b..74f871c 100755 --- a/app.py +++ b/app.py @@ -17,17 +17,13 @@ def home(): for reply in context['descendants']: if reply['account']['acct'] == author: descendants.append(clean_status(reply)) + status = clean_status(status) status['descendants'] = descendants - threads.append(clean_status(status)) + threads.append(status) return threads def clean_status(status): - clean = {k: status[k] for k in {'content', 'created_at', 'url'}} - if 'descendants' in status: - descendants = status['descendants'] - clean['descendants_count'] = len(descendants) - clean['descendants'] = descendants - return clean + return {k: status[k] for k in {'content', 'created_at', 'url'}} if __name__ == '__main__': app.run(host='0.0.0.0')