All Samples(11801) | Call(7142) | Derive(298) | Import(4361)
Class attributes:
standard_option_list : [Option]
list of standard options that will be accepted by all instances
of this parser class (intended to be overridden by subclasses).
Instance attributes:
usage : string
a usage string for your program. Before it is displayed
to the user, "%prog" will be expanded to the name of
your program (self.prog or os.path.basename(sys.argv[0])).
prog : string
the name of the current program (to override
os.path.basename(sys.argv[0])).
epilog : string
paragraph of help text to print after option help
option_groups : [OptionGroup]
list of option groups in this parser (option groups are
irrelevant for parsing the command-line, but very useful
for generating help)
allow_interspersed_args : bool = true
if true, positional arguments may be interspersed with options.
Assuming -a and -b each take a single argument, the command-line
-ablah foo bar -bboo baz
will be interpreted the same as
-ablah -bboo -- foo bar baz
If this flag were false, that command line would be interpreted as
-ablah -- foo bar -bboo baz
-- ie. we stop processing options as soon as we see the first
non-option argument. (This is the tradition followed by
Python's getopt module, Perl's Getopt::Std, and other argument-
parsing libraries, but it is generally annoying to users.)
process_default_values : bool = true
if true, option default values are processed similarly to option
values from the command line: that is, they are passed to the
type-checking function for the option's type (as long as the
default value is a string). (This really only matters if you
have defined custom types; see SF bug #955889.) Set it to false
to restore the behaviour of Optik 1.4.1 and earlier.
rargs : [string]
the argument list currently being parsed. Only set when
parse_args() is active, and continually trimmed down as
we consume arguments. Mainly there for the benefit of
callback options.
largs : [string]
the list of leftover arguments that we have skipped while
parsing options. If allow_interspersed_args is false, this
list is always empty.
values : Values
the set of option values currently being accumulated. Only
set when parse_args() is active. Also mainly for callbacks.
Because of the 'rargs', 'largs', and 'values' attributes,
OptionParser is not thread-safe. If, for some perverse reason, you
need to parse command-line arguments simultaneously in different
threads, use different OptionParser instances.src/c/j/cjklib-0.3/examples/dictionaryspeed.py cjklib(Download)
import imp import sys from timeit import Timer from optparse import OptionParser, OptionGroup, Values from sqlalchemy.sql import text from sqlalchemy.exc import OperationalError
def buildParser():
usage = "%prog [options]\n%prog reindex DB_FILE [--registerUnicode]"
description = "Gives timing statistics for dictionary access methods."
version = "%%prog %s" % str(cjklib.__version__)
parser = OptionParser(usage=usage, description=description, version=version)
# databases
src/g/e/genomedata-1.2.2/examples/genomedata_fill_random.py genomedata(Download)
def parse_args(args):
from optparse import OptionParser
usage = "%prog [OPTIONS] GENOMEDATAFILE"
parser = OptionParser(usage=usage, version=__version__,
description=__doc__.strip())
src/p/y/pymei-HEAD/sample_documents.py pymei(Download)
import os import sys from optparse import OptionParser from pymei.Import import xmltomei import logging
desc = """ This test script runs against the sample MEI documents in a folder
and determines whether it can parse them or not. Used to make sure
our script is able to handle "real-world" MEI."""
p = OptionParser(usage=usage, description=desc, version="%prog 0.1a")
p.add_option("-f", "--folder", action="store", help="Path to folder containing the sample documents")
p.add_option("-s", "--stop", action="store_true", help="Stop on errors.")
(options, args) = p.parse_args()
src/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/usrp/usrp_tv_rcv_nogui.py VT-USRP-daughterboard-drivers_python(Download)
from gnuradio import audio from gnuradio import usrp from gnuradio.eng_option import eng_option from optparse import OptionParser import sys try:
def __init__(self):
gr.top_block.__init__(self)
usage="%prog: [options] output_filename. \n Special output_filename \"sdl\" will use video_sink_sdl as realtime output window. " \
"You then need to have gr-video-sdl installed. \n" \
"Make sure your input capture file containes interleaved shorts not complex floats"
parser = OptionParser(option_class=eng_option, usage=usage)
src/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/multi_usrp/multi_usrp_rx_cfile.py VT-USRP-daughterboard-drivers_python(Download)
from gnuradio import audio from gnuradio import usrp from gnuradio.eng_option import eng_option from optparse import OptionParser import sys import time
def __init__(self):
gr.flow_graph.__init__(self)
usage="%prog: [options] output_filename"
parser = OptionParser(option_class=eng_option, usage=usage)
parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=(0, 0),
help="select USRP Rx side A or B (default=A)")
src/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/audio/dial_tone_wav.py VT-USRP-daughterboard-drivers_python(Download)
from gnuradio import gr
from gnuradio.eng_option import eng_option
from optparse import OptionParser
class my_top_block(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
usage = "%prog: [options] filename"
parser = OptionParser(option_class=eng_option, usage=usage)
src/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/audio/audio_to_file.py VT-USRP-daughterboard-drivers_python(Download)
from gnuradio import gr
from gnuradio import audio
from gnuradio.eng_option import eng_option
from optparse import OptionParser
class my_top_block(gr.top_block):
def __init__(self):
gr.top_block.__init__(self)
usage="%prog: [options] output_filename"
parser = OptionParser(option_class=eng_option, usage=usage)
src/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/usrp/usrp_spectrum_sense.py VT-USRP-daughterboard-drivers_python(Download)
from gnuradio import audio from gnuradio import usrp from gnuradio.eng_option import eng_option from optparse import OptionParser from usrpm import usrp_dbid import sys import math
def __init__(self):
gr.top_block.__init__(self)
usage = "usage: %prog [options] min_freq max_freq"
parser = OptionParser(option_class=eng_option, usage=usage)
parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=(0,0),
help="select USRP Rx side A or B (default=A)")
src/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/usrp/fm_tx_2_daughterboards.py VT-USRP-daughterboard-drivers_python(Download)
from gnuradio import audio from gnuradio import blks2 from gnuradio.eng_option import eng_option from optparse import OptionParser from usrpm import usrp_dbid import math import sys
def __init__(self):
gr.top_block.__init__(self)
usage="%prog: [options] side-A-tx-freq side-B-tx-freq"
parser = OptionParser (option_class=eng_option, usage=usage)
(options, args) = parser.parse_args ()
src/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/digital/tx_voice.py VT-USRP-daughterboard-drivers_python(Download)
from gnuradio import audio from gnuradio import eng_notation from gnuradio.eng_option import eng_option from optparse import OptionParser from gnuradio.vocoder import gsm_full_rate
mods = modulation_utils.type_1_mods()
parser = OptionParser(option_class=eng_option, conflict_handler="resolve")
expert_grp = parser.add_option_group("Expert")
parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(),
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next