def main(): parser = OptionParser( usage='mtop.py [options]\nSee also: https://github.com/beaufour/mtop') parser.add_option('-s', '--server', dest='server', default='localhost', help='connect to mongo on SERVER', metavar='SERVER') parser.add_option('-d', '--delay', dest='delay', type=int, default=1000, help='update every MS', metavar='MS') (options, _) = parser.parse_args() connection = get_connection(options.server) if not connection: print('Connection to %s failed' % (options.server)) return -1 runner = Runner(connection, options.delay) rc = runner.run() if rc == -3: print('Screen size too small') return rc
def main(): parser = OptionParser(usage="mtop.py [options]\nSee also: https://github.com/beaufour/mtop") parser.add_option( "-s", "--server", dest="server", default="localhost", help="connect to mongo on SERVER", metavar="SERVER" ) parser.add_option("-d", "--delay", dest="delay", type=int, default=1000, help="update every MS", metavar="MS") (options, _) = parser.parse_args() connection = get_connection(options.server) if not connection: print("Connection to %s failed" % (options.server)) return -1 runner = Runner(connection, options.delay) rc = runner.run() if rc == -3: print("Screen size too small") return rc
def setUp(self): connection = get_connection('localhost') self._mongo_ops = MongoOps(connection)
def setUp(self): connection = get_connection("localhost") self._mongo_ops = MongoOps(connection)