diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-09 03:14:08 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-09 03:14:08 +0300 |
commit | b4130ad6ee77fbfbf521dc5860de3f843451d118 (patch) | |
tree | b4ecfae1c518b5403339bc52a3601659c12385bb /mutual_friends.py | |
parent | README update (diff) | |
download | vk-scripts-b4130ad6ee77fbfbf521dc5860de3f843451d118.tar.gz vk-scripts-b4130ad6ee77fbfbf521dc5860de3f843451d118.zip |
refactoring
Diffstat (limited to 'mutual_friends.py')
-rw-r--r-- | mutual_friends.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mutual_friends.py b/mutual_friends.py index 9de77cb..20bb32a 100644 --- a/mutual_friends.py +++ b/mutual_friends.py @@ -2,8 +2,6 @@ # This file is licensed under the terms of the MIT License. # See LICENSE.txt for details. -import sys - from api import * def query_friends(api, user): @@ -17,15 +15,16 @@ def format_user(user): if __name__ == '__main__': import argparse + parser = argparse.ArgumentParser( description='Learn who your ex and her new boyfriend are both friends with.') - parser.add_argument(metavar='UID', dest='user_ids', nargs='+', + parser.add_argument(metavar='UID', dest='uids', nargs='+', help='user IDs or "screen names"') args = parser.parse_args() api = API(Language.EN) - users = api.users_get(args.user_ids, fields=User.Field.SCREEN_NAME) + users = api.users_get(args.uids, fields=User.Field.SCREEN_NAME) friend_lists = map(lambda user: frozenset(query_friends(api, user)), users) mutual_friends = frozenset.intersection(*friend_lists) |