flake8
This commit is contained in:
parent
60aa0772e9
commit
9b48b8ea81
@ -9,8 +9,10 @@ import argparse
|
||||
from pymongo import Connection
|
||||
from termcolor import colored
|
||||
|
||||
# global quit monitor
|
||||
quit = False
|
||||
|
||||
|
||||
def watch(dbname, refresh):
|
||||
global quit
|
||||
db = getattr(Connection('localhost'), dbname)
|
||||
@ -41,7 +43,8 @@ def watch(dbname, refresh):
|
||||
elif e['op'] == 'update':
|
||||
output.append(colored('update {query}'.format(**e), 'green'))
|
||||
elif e['op'] == 'getmore':
|
||||
output.append(colored('getmore {0}'.format(e.get('query', '')), 'grey'))
|
||||
output.append(colored('getmore {0}'.format(e.get('query', '')),
|
||||
'grey'))
|
||||
elif e['op'] == 'command':
|
||||
output.append(colored('{command}'.format(**e), 'cyan'))
|
||||
else:
|
||||
@ -64,6 +67,7 @@ def watch(dbname, refresh):
|
||||
last_ts = e['ts']
|
||||
time.sleep(refresh)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='watch mongo queries')
|
||||
parser.add_argument('dbname', help='name of database to watch')
|
||||
|
Loading…
Reference in New Issue
Block a user