aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/mutual_friends.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-01-22 09:36:50 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-01-22 09:36:50 +0300
commit736a26da764f61c9b71555dea7ffdbf3935c5591 (patch)
treead073852dc88303940c99caf0c0cef8c6cd1df30 /bin/mutual_friends.py
parentrevert most of the recent Pylint fixes (diff)
downloadvk-scripts-736a26da764f61c9b71555dea7ffdbf3935c5591.tar.gz
vk-scripts-736a26da764f61c9b71555dea7ffdbf3935c5591.zip
fix Pylint warnings
Diffstat (limited to '')
-rw-r--r--bin/mutual_friends.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/mutual_friends.py b/bin/mutual_friends.py
index 8e6e584..d8591cf 100644
--- a/bin/mutual_friends.py
+++ b/bin/mutual_friends.py
@@ -76,7 +76,10 @@ def _parse_output_format(s):
except ValueError:
raise argparse.ArgumentTypeError('invalid output format: ' + s)
-def _parse_args(args=sys.argv):
+def _parse_args(args=None):
+ if args is None:
+ args = sys.argv[1:]
+
parser = argparse.ArgumentParser(
description='Learn who your ex and her new boyfriend are both friends with.')
@@ -92,7 +95,7 @@ def _parse_args(args=sys.argv):
default=sys.stdout,
help='set output file path (standard output by default)')
- return parser.parse_args(args[1:])
+ return parser.parse_args(args)
def write_mutual_friends(uids, fmt=OutputFormat.CSV, fd=sys.stdout):
api = API(Language.EN)
@@ -104,9 +107,8 @@ def write_mutual_friends(uids, fmt=OutputFormat.CSV, fd=sys.stdout):
with fmt.create_writer(fd) as writer:
writer.write_mutual_friends(mutual_friends)
-def main(args=sys.argv):
- args = _parse_args(args)
- write_mutual_friends(**vars(args))
+def main(args=None):
+ write_mutual_friends(**vars(_parse_args(args)))
if __name__ == '__main__':
main()