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

All Samples(16)  |  Call(4)  |  Derive(0)  |  Import(12)

        def parseargs(argv, options, minargs = None, maxargs = None):
    config = {}
    longkeyed = {}
    for option in options:
        longname, default, doc = option
        longkeyed[longname] = option
        config[longname] = default
    options = []
    args = []
    pos = 0
    while pos < len(argv):
        if argv[pos][:2] != '--':
            args.append(argv[pos])
            pos += 1
        else:
            if pos == len(argv) - 1:
                usage('parameter passed in at end with no value')
            key, value = argv[pos][2:], argv[pos+1]
            pos += 2
            if not longkeyed.has_key(key):
                usage('unknown key --' + key)
            longname, default, doc = longkeyed[key]
            try:
                t = type(config[longname])
                if t is NoneType or t is StringType:
                    config[longname] = value
                elif t in (IntType, LongType):
                    config[longname] = long(value)
                elif t is FloatType:
                    config[longname] = float(value)
                else:
                    assert 0
            except ValueError, e:
                usage('wrong format of --%s - %s' % (key, str(e)))
    for key, value in config.items():
        if value is None:
            usage("Option --%s is required." % 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/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/configfile.py   kamaelia(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)
 

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/track.py   kamaelia(Download)
from BitTorrent.obsoletepythonsupport import *
 
from BitTorrent.parseargs import parseargs, formatDefinitions
from BitTorrent.RawServer_magic import RawServer
from BitTorrent.HTTPHandler import HTTPHandler, months, weekdays
        return
    try:
        config, files = parseargs(args, defaults, 0, 0)
    except ValueError, e:
        print _("error: ") + str(e)

src/b/e/benflix-HEAD/videoportal/BitTorrent/btmakemetafile.py   benflix(Download)
from BitTorrent.bencode import bencode
from BitTorrent.btformats import check_info
from BitTorrent.parseargs import parseargs, formatDefinitions
from threading import Event
from time import time
    else:
        try:
            config, args = parseargs(argv[3:], defaults, 0, 0)
            make_meta_file(argv[1], argv[2], config['piece_size_pow2'], progress = prog,
                comment = config['comment'], target = config['target'])

src/k/a/kamaelia-HEAD/Sketches/RJL/Packages/Kamaelia/Community/RJL/Kamaelia/Protocol/Torrent/TorrentMaker.py   kamaelia(Download)
#from BitTorrent import configfile
from BitTorrent.makemetafile import make_meta_files
from BitTorrent.parseargs import parseargs, printHelp
from BitTorrent import BTFailure
 

src/k/a/kamaelia-HEAD/Sketches/RJL/Kamaelia/Community/RJL/Kamaelia/Protocol/Torrent/TorrentMaker.py   kamaelia(Download)
#from BitTorrent import configfile
from BitTorrent.makemetafile import make_meta_files
from BitTorrent.parseargs import parseargs, printHelp
from BitTorrent import BTFailure
 

src/k/a/kamaelia-HEAD/Code/Python/Kamaelia/Kamaelia/Protocol/Torrent/TorrentMaker.py   kamaelia(Download)
#from BitTorrent import configfile
from BitTorrent.makemetafile import make_meta_files
from BitTorrent.parseargs import parseargs, printHelp
from BitTorrent import BTFailure
 

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/BitTorrent/makemetafile.py   kamaelia(Download)
from BitTorrent.bencode import bencode, bdecode
from BitTorrent.btformats import check_info
from BitTorrent.parseargs import parseargs, printHelp
from BitTorrent.obsoletepythonsupport import *
from BitTorrent import BTFailure

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/maketorrent-console.py   kamaelia(Download)
from BitTorrent import configfile
from BitTorrent.makemetafile import make_meta_files
from BitTorrent.parseargs import parseargs, printHelp
from BitTorrent import BTFailure
 

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/launchmany-curses.py   kamaelia(Download)
from BitTorrent.launchmanycore import LaunchMany
from BitTorrent.defaultargs import get_defaults
from BitTorrent.parseargs import parseargs, printHelp
from BitTorrent import configfile
from BitTorrent import version

src/k/a/kamaelia-HEAD/Sketches/RJL/bittorrent/BitTorrent/launchmany-console.py   kamaelia(Download)
from BitTorrent.launchmanycore import LaunchMany
from BitTorrent.defaultargs import get_defaults
from BitTorrent.parseargs import parseargs, printHelp
from BitTorrent import configfile
from BitTorrent import version

  1 | 2  Next