aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--.pylintrc28
-rw-r--r--bin/mutual_friends.py12
-rw-r--r--bin/online_sessions.py12
-rw-r--r--bin/track_status.py12
4 files changed, 21 insertions, 43 deletions
diff --git a/.pylintrc b/.pylintrc
index 2cca631..49e1c11 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -1,35 +1,7 @@
[MESSAGES CONTROL]
-#disable=old-ne-operator,filter-builtin-not-iterating,nonzero-method,long-builtin,unpacking-in-except,backtick,suppressed-message,setslice-method,round-builtin,coerce-builtin,input-builtin,raising-string,raw_input-builtin,apply-builtin,delslice-method,useless-suppression,hex-method,zip-builtin-not-iterating,range-builtin-not-iterating,intern-builtin,old-octal-literal,xrange-builtin,no-absolute-import,cmp-builtin,reduce-builtin,next-method-called,getslice-method,oct-method,reload-builtin,dict-view-method,file-builtin,long-suffix,parameter-unpacking,dict-iter-method,cmp-method,old-division,using-cmp-argument,buffer-builtin,old-raise-syntax,indexing-exception,unicode-builtin,unichr-builtin,coerce-method,basestring-builtin,map-builtin-not-iterating,metaclass-assignment,print-statement,import-star-module-level,standarderror-builtin,execfile-builtin
disable=duplicate-code,invalid-name,missing-docstring,multiple-imports,too-many-public-methods,too-few-public-methods
[BASIC]
-#bad-functions=map,filter
bad-functions=
-#good-names=i,j,k,ex,Run,_
-#bad-names=foo,bar,baz,toto,tutu,tata
-#name-group=
-#include-naming-hint=no
-#class-rgx=[A-Z_][a-zA-Z0-9]+$
-#class-name-hint=[A-Z_][a-zA-Z0-9]+$
-#module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-#module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
-#inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
-#inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
-#variable-rgx=[a-z_][a-z0-9_]{2,30}$
-#variable-name-hint=[a-z_][a-z0-9_]{2,30}$
-#const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
-#const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
-#function-rgx=[a-z_][a-z0-9_]{2,30}$
-#function-name-hint=[a-z_][a-z0-9_]{2,30}$
-#attr-rgx=[a-z_][a-z0-9_]{2,30}$
-#attr-name-hint=[a-z_][a-z0-9_]{2,30}$
-#argument-rgx=[a-z_][a-z0-9_]{2,30}$
-#argument-name-hint=[a-z_][a-z0-9_]{2,30}$
-#method-rgx=[a-z_][a-z0-9_]{2,30}$
-#method-name-hint=[a-z_][a-z0-9_]{2,30}$
-#class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
-#class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
-#no-docstring-rgx=^_
-#docstring-min-length=-1
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()
diff --git a/bin/online_sessions.py b/bin/online_sessions.py
index ac182e7..153878f 100644
--- a/bin/online_sessions.py
+++ b/bin/online_sessions.py
@@ -379,7 +379,10 @@ def _parse_date_range_limit(s):
raise argparse.ArgumentTypeError(
msg.format(_DATE_RANGE_LIMIT_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='View/visualize the amount of time people spend online.')
@@ -412,7 +415,7 @@ def _parse_args(args=sys.argv):
type=_parse_date_range_limit, default=None,
help='discard online activity after this moment')
- return parser.parse_args(args[1:])
+ return parser.parse_args(args)
def process_online_sessions(
db_fd, db_fmt=DatabaseFormat.CSV,
@@ -429,9 +432,8 @@ def process_online_sessions(
output_writer.process_database(
group_by, db_reader, time_from=time_from, time_to=time_to)
-def main(args=sys.argv):
- args = _parse_args(args)
- process_online_sessions(**vars(args))
+def main(args=None):
+ process_online_sessions(**vars(_parse_args(args)))
if __name__ == '__main__':
main()
diff --git a/bin/track_status.py b/bin/track_status.py
index c221c53..d8d8908 100644
--- a/bin/track_status.py
+++ b/bin/track_status.py
@@ -27,7 +27,10 @@ def _parse_database_format(s):
except ValueError:
raise argparse.ArgumentTypeError('invalid database 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='Track when people go online/offline.')
@@ -51,7 +54,7 @@ def _parse_args(args=sys.argv):
default=None,
help='set database file path')
- return parser.parse_args(args[1:])
+ return parser.parse_args(args)
def track_status(
uids, timeout=DEFAULT_TIMEOUT,
@@ -70,9 +73,8 @@ def track_status(
tracker.add_database_writer(db_writer)
tracker.loop(uids)
-def main(args=sys.argv):
- args = _parse_args(args)
- track_status(**vars(args))
+def main(args=None):
+ track_status(**vars(_parse_args(args)))
if __name__ == '__main__':
main()