chore: use getters

This commit is contained in:
Timothy Quilling 2023-06-30 00:11:33 -04:00
parent b7ef2be02e
commit e290f2c05f

View file

@ -74,7 +74,7 @@ def add_user_posts(server, access_token, followings, know_followings, all_known_
count = 0
failed = 0
for post in posts:
if post['reblog'] == None and post['url'] != None and post['url'] not in seen_urls:
if post.get('reblog') is None and post.get('url') is not None and post.get('url') not in seen_urls:
added = add_post_with_context(post, server, access_token, seen_urls)
if added is True:
seen_urls.add(post['url'])
@ -90,7 +90,7 @@ def add_post_with_context(post, server, access_token, seen_urls):
added = add_context_url(post['url'], server, access_token)
if added is True:
seen_urls.add(post['url'])
if (post['replies_count'] or post['in_reply_to_id']) and arguments.backfill_with_context > 0:
if ('replies_count' in post or 'in_reply_to_id' in post) and getattr(arguments, 'backfill_with_context', 0) > 0:
parsed_urls = {}
parsed = parse_url(post['url'], parsed_urls)
if parsed == None: