mirror of
https://github.com/ihabunek/toot
synced 2024-12-22 23:08:17 +01:00
Fix formatting
This commit is contained in:
parent
d03a329b1a
commit
654bc06166
@ -300,6 +300,7 @@ def follow(app, user, account):
|
||||
def unfollow(app, user, account):
|
||||
return _account_action(app, user, account, 'unfollow')
|
||||
|
||||
|
||||
def _get_account_list(app, user, path):
|
||||
accounts = []
|
||||
while path:
|
||||
@ -308,10 +309,12 @@ def _get_account_list(app, user, path):
|
||||
path = _get_next_path(response.headers)
|
||||
return accounts
|
||||
|
||||
|
||||
def following(app, user, account):
|
||||
path = '/api/v1/accounts/{}/{}'.format(account, 'following')
|
||||
return _get_account_list(app, user, path)
|
||||
|
||||
|
||||
def followers(app, user, account):
|
||||
path = '/api/v1/accounts/{}/{}'.format(account, 'followers')
|
||||
return _get_account_list(app, user, path)
|
||||
@ -344,7 +347,7 @@ def single_status(app, user, status_id):
|
||||
|
||||
|
||||
def get_notifications(app, user, exclude_types=[], limit=20):
|
||||
params={"exclude_types[]": exclude_types, "limit": limit}
|
||||
params = {"exclude_types[]": exclude_types, "limit": limit}
|
||||
return http.get(app, user, '/api/v1/notifications', params).json()
|
||||
|
||||
|
||||
|
@ -279,11 +279,13 @@ def unfollow(app, user, args):
|
||||
api.unfollow(app, user, account['id'])
|
||||
print_out("<green>✓ You are no longer following {}</green>".format(args.account))
|
||||
|
||||
|
||||
def following(app, user, args):
|
||||
account = _find_account(app, user, args.account)
|
||||
response = api.following(app, user, account['id'])
|
||||
print_acct_list(response)
|
||||
|
||||
|
||||
def followers(app, user, args):
|
||||
account = _find_account(app, user, args.account)
|
||||
response = api.followers(app, user, account['id'])
|
||||
|
@ -138,6 +138,7 @@ HASHTAG_PATTERN = re.compile(r'(?<!\w)(#\w+)\b')
|
||||
def highlight_hashtags(line):
|
||||
return re.sub(HASHTAG_PATTERN, '<cyan>\\1</cyan>', line)
|
||||
|
||||
|
||||
def print_acct_list(accounts):
|
||||
for account in accounts:
|
||||
print_out("* <green>@{}</green> {}".format(
|
||||
@ -145,6 +146,7 @@ def print_acct_list(accounts):
|
||||
account['display_name']
|
||||
))
|
||||
|
||||
|
||||
def print_search_results(results):
|
||||
accounts = results['accounts']
|
||||
hashtags = results['hashtags']
|
||||
|
Loading…
Reference in New Issue
Block a user