MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / parse_args

Function parse_args

test/mod_wsgi_test/test_client.py:27–83  ·  view source on GitHub ↗
(args=None)

Source from the content-addressed store, hash-verified

25
26
27def parse_args(args=None):
28 parser = OptionParser(
29 """usage: %prog [options] mode url [<url2>...]
30
31 mode:\tparallel or serial"""
32 )
33
34 # Should be enough that any connection leak will exhaust available file
35 # descriptors.
36 parser.add_option(
37 "-n",
38 "--nrequests",
39 type="int",
40 dest="nrequests",
41 default=50 * 1000,
42 help="Number of times to GET the URLs, in total",
43 )
44
45 parser.add_option(
46 "-t",
47 "--nthreads",
48 type="int",
49 dest="nthreads",
50 default=100,
51 help="Number of threads with mode 'parallel'",
52 )
53
54 parser.add_option(
55 "-q",
56 "--quiet",
57 action="store_false",
58 dest="verbose",
59 default=True,
60 help="Don't print status messages to stdout",
61 )
62
63 parser.add_option(
64 "-c",
65 "--continue",
66 action="store_true",
67 dest="continue_",
68 default=False,
69 help="Continue after HTTP errors",
70 )
71
72 try:
73 options, args = parser.parse_args(args or sys.argv[1:])
74 mode, urls = args[0], args[1:]
75 except (ValueError, IndexError):
76 parser.print_usage()
77 sys.exit(1)
78
79 if mode not in ("parallel", "serial"):
80 parser.print_usage()
81 sys.exit(1)
82
83 return options, mode, urls
84

Callers 1

test_client.pyFile · 0.85

Calls 1

add_optionMethod · 0.45

Tested by

no test coverage detected