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