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

All Samples(16)  |  Call(8)  |  Derive(0)  |  Import(8)
Format command-line options and documentation to fit into a given
column width

Parameters
    tuple[] - (flag, default, docstring) tuples describing each flag
    int     - Number of columns to write
    dict    - {flag: value} overrides for default values (default: {})

Return
    str     - Printable output

        def formatDefinitions(options, COLS, presets={}):
    """Format command-line options and documentation to fit into a given
    column width

    Parameters
        tuple[] - (flag, default, docstring) tuples describing each flag
        int     - Number of columns to write
        dict    - {flag: value} overrides for default values (default: {})

    Return
        str     - Printable output
    """

    # Number of spaces before each line
    # Default to 10, but reduce to 1 if this results in very low width
    spaces = " " * 10
    width = COLS - 11
    if width < 15:
        width = COLS - 2
        spaces = " "

    lines = []
    # Display flag name, followed by indented documentation string
    for (longname, default, doc) in options:
        lines.append("--{} ".format(longname))
        default = presets.get(longname, default)

        # Don't add default info for empty strings or None
        if default not in ('', None):
            doc += ' (defaults to {})'.format(default)

        # Word wrap documentation string
        while len(doc) > width:
            pre, sep, post = doc[:width].rpartition(' ')
            doc = post + doc[width:]
            lines.append(spaces + pre)
        if doc:
            lines.append(spaces + doc)

        lines.append('')
    return '\n'.join(lines)
        


src/f/r/FriendlyTorrent-HEAD/src/tornado/btmakemetafile.py   FriendlyTorrent(Download)
assert version >= '2', "Install Python 2.0 or greater"
from BitTornado.BT1.makemetafile import make_meta_file, defaults, print_announcelist_details
from BitTornado.parseargs import parseargs, formatDefinitions
 
 
    print 'Usage: ' + b + ' <trackerurl> <file> [file...] [params...]'
    print
    print formatDefinitions(defaults, 80)
    print_announcelist_details()
    print ('')

src/b/i/BitTornado-HEAD/btmakemetafile.py   BitTornado(Download)
from BitTornado.BT1.makemetafile import make_meta_file, defaults, \
    announcelist_details
from BitTornado.parseargs import parseargs, formatDefinitions
 
 
 
    if len(argv) < 3:
        print "{}\n\n{}{}".format(usage, formatDefinitions(defaults, 80),
                                  announcelist_details)
        return 2

src/b/i/BitTornado-HEAD/btcompletedir.py   BitTornado(Download)
from BitTornado.BT1.makemetafile import defaults, completedir, \
    announcelist_details
from BitTornado.parseargs import parseargs, formatDefinitions
 
 
    if len(argv) < 3:
        print "{}\n{}\n{}{}".format(usage, desc,
                                    formatDefinitions(defaults, 80),
                                    announcelist_details)
        return 2

src/f/r/FriendlyTorrent-HEAD/src/tornado/BitTornado/BT1/track.py   FriendlyTorrent(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.parseargs import parseargs, formatDefinitions
from BitTornado.RawServer import RawServer, autodetect_ipv6, autodetect_socket_style
def track(args):
    if len(args) == 0:
        print formatDefinitions(defaults, 80)
        return
    try:

src/b/i/BitTornado-HEAD/BitTornado/BT1/track.py   BitTornado(Download)
from BitTornado.NetworkAddress import is_ipv4, is_valid_ip, ipv6_to_ipv4, \
    to_ipv4, AddrList
from BitTornado.parseargs import parseargs, formatDefinitions
from BitTornado.RawServer import RawServer, autodetect_socket_style
from BitTornado.HTTPHandler import HTTPHandler, months
def track(args):
    if len(args) == 0:
        print formatDefinitions(defaults, 80)
        return
    try:

src/o/w/OwnTube-HEAD/videoportal/BitTornadoABC/BitTornado/BT1/track.py   OwnTube(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.parseargs import parseargs, formatDefinitions
from BitTornado.RawServer import RawServer, autodetect_socket_style
def track(args):
    if not args:
        print formatDefinitions(defaults, 80)
        return
    try:

src/h/e/Herd-HEAD/BitTornado/BT1/track.py   Herd(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.parseargs import parseargs, formatDefinitions
from BitTornado.RawServer import RawServer, autodetect_ipv6, autodetect_socket_style
def track(args):
    if len(args) == 0:
        print formatDefinitions(defaults, 80)
        return
    try:

src/s/w/swarm-HEAD/BitTornado/BT1/track.py   swarm(Download)
# Written by Bram Cohen
# see LICENSE.txt for license information
 
from BitTornado.parseargs import parseargs, formatDefinitions
from BitTornado.RawServer import RawServer, autodetect_ipv6, autodetect_socket_style
def track(args):
    if len(args) == 0:
        print formatDefinitions(defaults, 80)
        return
    try: