示例#1
0
文件: test_core.py 项目: rubik/mando

program = Program('example.py', '1.0.10')


def NoopCompleter(prefix, **kwd):
    return []


program.option(
    "-f", "--foo", dest='foo', default='bar', completer=NoopCompleter,
    help="Real programmers don't comment their code. \
          If it was hard to write, it should be hard to read."
)

program.add_subprog('sub')
program.sub.option(
    "-i", "--inc", dest='inc', type=int, default=0,
    help="Some help text."
)


@program.command
def getopt(name):
    '''
        :param name: Name of option to return.
    '''
    # also allows for: Script.foo
    return getattr(program, name)

示例#2
0

program = Program('example.py', '1.0.10')


def NoopCompleter(prefix, **kwd):
    return []


program.option(
    "-f", "--foo", dest='foo', default='bar', completer=NoopCompleter,
    help="Real programmers don't comment their code. \
          If it was hard to write, it should be hard to read."
)

program.add_subprog('sub')
program.sub.option(
    "-i", "--inc", dest='inc', type=int, default=0,
    help="Some help text."
)


@program.command
def getopt(name):
    '''
        :param name: Name of option to return.
    '''
    # also allows for: Script.foo
    return getattr(program, name)

示例#3
0
import os.path
import sys
import warnings

from mando import Program
from mando.rst_text_formatter import RSTHelpFormatter
from tstoolbox import tsutils

from . import disaggregate, pet

warnings.filterwarnings("ignore")

program = Program("mettoolbox", "0.0")

program.add_subprog("disaggregate")
program.add_subprog("pet")

_LOCAL_DOCSTRINGS = tsutils.docstrings
_LOCAL_DOCSTRINGS["latitude"] = """latitude:
        The latitude of the location expressed in decimal degrees.  The
        southern hemisphere is expressed as a negative value."""
_LOCAL_DOCSTRINGS["longitude"] = """longitude:
        The longitude of the location expressed in decimal degrees.  The
        western hemisphere is expressed as a negative value."""
_LOCAL_DOCSTRINGS["vardesc"] = """If int or float use the value.  If
        array_like, then convert to numpy array.  If string, then split
        on commas and use as array_like.

        If None (the default) then `input_ts` and `columns` must be set."""
sunits = _LOCAL_DOCSTRINGS["source_units"]