From 46666e9edf43163920bae3f76c446341de034d67 Mon Sep 17 00:00:00 2001 From: Jesse Weinstein Date: Mon, 2 Jan 2023 22:54:28 -0500 Subject: [PATCH] Apply black code formatter --- src/tootstream/toot.py | 61 ++++++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/src/tootstream/toot.py b/src/tootstream/toot.py index 8041369..c8c4bde 100644 --- a/src/tootstream/toot.py +++ b/src/tootstream/toot.py @@ -9,6 +9,7 @@ import shutil from collections import OrderedDict import webbrowser + # Get the version of Tootstream import pkg_resources # part of setuptools import click @@ -1982,62 +1983,76 @@ def listaccounts(mastodon, rest): def listdifference(mastodon, rest): """Remove users in the second list from the first list. ex: listdifference list_to_remove_from list_of_what_to_remove""" - if not(list_support(mastodon)): + if not (list_support(mastodon)): return if not rest: - cprint("Argument required.", fg('red')) + cprint("Argument required.", fg("red")) return - items = rest.split(' ') + items = rest.split(" ") if len(items) < 2: - cprint("Not enough arguments.", fg('red')) + cprint("Not enough arguments.", fg("red")) return list_id = get_list_id(mastodon, items[0]) diff_list_id = get_list_id(mastodon, items[1]) list_accounts = mastodon.fetch_remaining(mastodon.list_accounts(diff_list_id)) - existing_ids = [x['id'] for x in mastodon.fetch_remaining(mastodon.list_accounts(list_id))] + existing_ids = [ + x["id"] for x in mastodon.fetch_remaining(mastodon.list_accounts(list_id)) + ] for user in list_accounts: - if user['id'] in existing_ids: - cprint("User {} already missing from list {}.".format( - format_username(user), items[0]), fg('green')) + if user["id"] in existing_ids: + cprint( + "User {} already missing from list {}.".format( + format_username(user), items[0] + ), + fg("green"), + ) else: - mastodon.list_accounts_delete(list_id, user['id']) - cprint("Removed {} from list {}.".format( - format_username(user), items[0]), fg('green')) + mastodon.list_accounts_delete(list_id, user["id"]) + cprint( + "Removed {} from list {}.".format(format_username(user), items[0]), + fg("green"), + ) @command(" ", "List") def listunion(mastodon, rest): """Add users in the second list to the first list. ex: listunion list_to_add_to list_of_what_to_add""" - if not(list_support(mastodon)): + if not (list_support(mastodon)): return if not rest: - cprint("Argument required.", fg('red')) + cprint("Argument required.", fg("red")) return - items = rest.split(' ') + items = rest.split(" ") if len(items) < 2: - cprint("Not enough arguments.", fg('red')) + cprint("Not enough arguments.", fg("red")) return list_id = get_list_id(mastodon, items[0]) if items[1] == "[following]": user = mastodon.account_verify_credentials() - list_accounts = mastodon.fetch_remaining(mastodon.account_following(user['id'])) + list_accounts = mastodon.fetch_remaining(mastodon.account_following(user["id"])) else: union_list_id = get_list_id(mastodon, items[1]) list_accounts = mastodon.fetch_remaining(mastodon.list_accounts(union_list_id)) - existing_ids = [x['id'] for x in mastodon.fetch_remaining(mastodon.list_accounts(list_id))] + existing_ids = [ + x["id"] for x in mastodon.fetch_remaining(mastodon.list_accounts(list_id)) + ] for user in list_accounts: - if user['id'] in existing_ids: - cprint("User {} already on list {}.".format( - format_username(user), items[0]), fg('green')) + if user["id"] in existing_ids: + cprint( + "User {} already on list {}.".format(format_username(user), items[0]), + fg("green"), + ) else: - mastodon.list_accounts_add(list_id, user['id']) - cprint("Added {} to list {}.".format( - format_username(user), items[0]), fg('green')) + mastodon.list_accounts_add(list_id, user["id"]) + cprint( + "Added {} to list {}.".format(format_username(user), items[0]), + fg("green"), + ) @command(" ", "List")