Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(15)  |  Call(5)  |  Derive(0)  |  Import(10)

        def parseargs(argv, options, minargs = None, maxargs = None, presets = None):
    config = {}
    for option in options:
        longname, default, doc = option
        config[longname] = default
    args = []
    pos = 0
    if presets is None:
        presets = {}
    else:
        presets = presets.copy()
    while pos < len(argv):
        if argv[pos][:1] != '-':             # not a cmdline option
            args.append(argv[pos])
            pos += 1
        else:
            key, value = None, None
            if argv[pos][:2] == '--':        # --aaa 1
                if pos == len(argv) - 1:
                    usage('parameter passed in at end with no value')
                key, value = argv[pos][2:], argv[pos+1]
                pos += 2
            elif argv[pos][:1] == '-':
                key = argv[pos][1:2]
                if len(argv[pos]) > 2:       # -a1
                    value = argv[pos][2:]
                    pos += 1
                else:                        # -a 1
                    if pos == len(argv) - 1:
                        usage('parameter passed in at end with no value')
                    value = argv[pos+1]
                    pos += 2
            else:
                raise BTFailure('command line parsing failed at '+argv[pos])

            presets[key] = value
    parse_options(config, presets)
    config.update(presets)
    for key, value in config.items():
        if value is None:
            usage("Option %s is required." % format_key(key))
    if minargs is not None and len(args) < minargs:
        usage("Must supply at least %d args." % minargs)
    if maxargs is not None and len(args) > maxargs:
        usage("Too many args - %d max." % maxargs)
    return (config, args)
        


src/a/n/Anomos-HEAD/Anomos/configfile.py   Anomos(Download)
 
    presets = get_config(defconfig, uiname)
    config, args = parseargs.parseargs(arglist, defaults, minargs, maxargs,
                                       presets)
    datadir = config['data_dir']
            parseargs.parse_options(defconfig, values)
            presets.update(values)
            config, args = parseargs.parseargs(arglist, defaults, minargs,
                                               maxargs, presets)
        rdir = os.path.join(datadir, 'resume')

src/a/n/Anomos-HEAD/anontrack.py   Anomos(Download)
import sys
 
from Anomos.parseargs import parseargs, formatDefinitions
from Anomos.track import defaults, Tracker
 
        return
    try:
        config, files = parseargs(argv, defaults, 0, 0)
    except ValueError, e:
        print 'error: ' + str(e)

src/a/n/Anomos-HEAD/Anomos/track.py   Anomos(Download)
from Anomos.NetworkModel import NetworkModel
from Anomos.bencode import bencode, bdecode, Bencached
from Anomos.parseargs import parseargs, formatDefinitions
from Anomos.parsedir import parsedir
from Anomos import bttime, version, is_valid_ipv4, LOG as log
        return
    try:
        config, files = parseargs(args, defaults, 0, 0)
    except ValueError, e:
        print 'error: ' + str(e)

src/a/n/Anomos-HEAD/makeatorrent.py   Anomos(Download)
import sys
from Anomos.makemetafile import make_meta_files
from Anomos.parseargs import parseargs, printHelp
from Anomos import BTFailure
 
    else:
        try:
            config, args = parseargs(sys.argv[1:], defaults, 2, None)
            print config
            print args

src/a/n/Anomos-HEAD/Anomos/TwistedServer.py   Anomos(Download)
from twisted.internet.selectreactor import SelectReactor, _NO_FILENO, _NO_FILEDESC
 
from Anomos.parseargs import parseargs, formatDefinitions
from Anomos.track import defaults, isotime, Tracker
import Anomos.Crypto

src/a/n/Anomos-HEAD/Anomos/makemetafile.py   Anomos(Download)
from Anomos.bencode import bencode
from Anomos.btformats import check_info
from Anomos.parseargs import parseargs, printHelp
from Anomos import bttime, BTFailure
 

src/a/n/Anomos-HEAD/anonlaunchmanycurses.py   Anomos(Download)
from Anomos.launchmanycore import LaunchMany
from Anomos.defaultargs import get_defaults
from Anomos.parseargs import parseargs, printHelp
from Anomos import configfile
from Anomos import version

src/a/n/Anomos-HEAD/anonlaunchmany.py   Anomos(Download)
from Anomos.launchmanycore import LaunchMany
from Anomos.defaultargs import get_defaults
from Anomos.parseargs import parseargs, printHelp
from Anomos import configfile
from Anomos import version

src/a/n/Anomos-HEAD/anondownloadheadless.py   Anomos(Download)
from Anomos.download import Feedback, Multitorrent
from Anomos.defaultargs import get_defaults
from Anomos.parseargs import parseargs, printHelp
from Anomos.bencode import bdecode
from Anomos.ConvertedMetainfo import ConvertedMetainfo

src/a/n/Anomos-HEAD/anondownloadgui.py   Anomos(Download)
from Anomos.controlsocket import ControlSocket
from Anomos.defaultargs import get_defaults
from Anomos.parseargs import parseargs, makeHelp
from Anomos.GUI import *
from Anomos.bencode import bdecode, bencode

  1 | 2  Next