diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2019-12-23 07:20:36 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2019-12-23 07:20:36 +0300 |
commit | 7b8cc8a9f455eda41b9c7d70f4561a84fcda941e (patch) | |
tree | b9e262e9a1dbb663c3b9f704a9fe4daf54be0ce9 /bin/track_status.py | |
parent | Travis: online_sessions.sh: refactoring (diff) | |
download | vk-scripts-7b8cc8a9f455eda41b9c7d70f4561a84fcda941e.tar.gz vk-scripts-7b8cc8a9f455eda41b9c7d70f4561a84fcda941e.zip |
pylint/pep8 fixes
Diffstat (limited to '')
-rw-r--r-- | bin/track_status.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/bin/track_status.py b/bin/track_status.py index 9c32ae9..2a974a5 100644 --- a/bin/track_status.py +++ b/bin/track_status.py @@ -3,15 +3,18 @@ # For details, see https://github.com/egor-tensin/vk-scripts. # Distributed under the MIT License. -import argparse, sys +import argparse +import sys from vk.api import API from vk.tracking import StatusTracker from vk.tracking.db import Format as DatabaseFormat + DEFAULT_TIMEOUT = StatusTracker.DEFAULT_TIMEOUT DEFAULT_DB_FORMAT = DatabaseFormat.CSV + def _parse_positive_integer(s): try: n = int(s) @@ -21,12 +24,14 @@ def _parse_positive_integer(s): raise argparse.ArgumentTypeError('must be a positive integer: ' + s) return n + def _parse_database_format(s): try: return DatabaseFormat(s) except ValueError: raise argparse.ArgumentTypeError('invalid database format: ' + s) + def _parse_args(args=None): if args is None: args = sys.argv[1:] @@ -52,6 +57,7 @@ def _parse_args(args=None): return parser.parse_args(args) + def track_status( uids, timeout=DEFAULT_TIMEOUT, log_path=None, @@ -72,8 +78,10 @@ def track_status( tracker.loop(uids) + def main(args=None): track_status(**vars(_parse_args(args))) + if __name__ == '__main__': main() |