Example #1
0
    def test_lineBreaks(self):
        testStr = """foo bar
                  baz

                  boz

                  qux"""
        self.assertEqual(unwrap(testStr), "foo bar baz\n\nboz\n\nqux")
Example #2
0
 def __init__(self):
     self.decorators = [
         option_section(sectionText="Pipeline build options:"),
         ctrlMpExecOpts.pipeline_option(),
         ctrlMpExecOpts.task_option(),
         ctrlMpExecOpts.delete_option(metavar="LABEL"),
         dafButlerOpts.config_option(metavar="LABEL:NAME=VALUE",
                                     multiple=True),
         dafButlerOpts.config_file_option(help=unwrap(
             """Configuration override file(s), applies to a task
                                                      with a given label."""
         ),
                                          metavar="LABEL:FILE",
                                          multiple=True),
         ctrlMpExecOpts.order_pipeline_option(),
         ctrlMpExecOpts.save_pipeline_option(),
         ctrlMpExecOpts.pipeline_dot_option(),
         obsBaseOpts.instrument_option(help=instrumentOptionHelp,
                                       metavar="instrument",
                                       multiple=True)
     ]
Example #3
0
import click

from lsst.daf.butler.cli.opt import (config_file_option, config_option,
                                     options_file_option)
from lsst.daf.butler.cli.utils import (MWCtxObj, option_section, unwrap)
import lsst.obs.base.cli.opt as obsBaseOpts
from .. import opt as ctrlMpExecOpts
from .. import script
from ..utils import makePipelineActions, PipetaskCommand

epilog = unwrap("""Notes:

--task, --delete, --config, --config-file, and --instrument action options can
appear multiple times; all values are used, in order left to right.

FILE reads command-line options from the specified file. Data may be
distributed among multiple lines (e.g. one option per line). Data after # is
treated as a comment and ignored. Blank lines and lines starting with # are
ignored.)
""")


def _doBuild(ctx, **kwargs):
    # The pipeline actions (task, delete, config, config_file, and instrument)
    # must be handled in the order they appear on the command line, but the CLI
    # specification gives them all different option names. So, instead of using
    # the individual action options as they appear in kwargs (because
    # invocation order can't be known), we capture the CLI arguments by
    # overriding `click.Command.parse_args` and save them in the Context's
    # `obj` parameter. We use `makePipelineActions` to create a list of
    # pipeline actions from the CLI arguments and pass that list to the script
Example #4
0

delete_option = MWOptionDecorator("--delete",
                                  callback=split_commas,
                                  help="Delete task with given label from pipeline.",
                                  multiple=True)


do_raise_option = MWOptionDecorator("--do-raise",
                                    help="Raise an exception on error. (else log a message and continue?)",
                                    is_flag=True)


extend_run_option = MWOptionDecorator("--extend-run",
                                      help=unwrap("""Instead of creating a new RUN collection, insert datasets
                                                  into either the one given by --output-run (if provided) or
                                                  the first child collection of - -output(which must be of
                                                  type RUN)."""),
                                      is_flag=True)


graph_fixup_option = MWOptionDecorator("--graph-fixup",
                                       help=unwrap("""Name of the class or factory method which makes an
                                                   instance used for execution graph fixup."""))


init_only_option = MWOptionDecorator("--init-only",
                                     help=unwrap("""Do not actually run; just register dataset types and/or
                                                 save init outputs. """),
                                     is_flag=True)

Example #5
0
 def test_trailingNewline(self):
     testStr = """
         foo bar
         baz
         """
     self.assertEqual(unwrap(testStr), "foo bar baz")
Example #6
0
 def test_leadingContent(self):
     testStr = """foo bar
         baz """
     self.assertEqual(unwrap(testStr), "foo bar baz")
Example #7
0
 def test_oneLineWithTrailing(self):
     testStr = """foo bar baz
         """
     self.assertEqual(unwrap(testStr), "foo bar baz")
Example #8
0
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.


import click

from lsst.daf.butler.cli.utils import (
    MWArgumentDecorator,
    split_commas,
    unwrap,
)


num_subfilters_argument = MWArgumentDecorator(
    "NUM_SUBFILTERS",
    help="NUM_SUBFILTERS is the number of subfilters to be used for chromatic modeling.",
    type=click.IntRange(min=1),
    required=True
)

band_names_argument = MWArgumentDecorator(
    "BAND_NAMES",
    help=unwrap("""BAND_NAMES names of the bands to define chromatic subfilters for in the registry. Each
                band will have the same number of subfilters defined, for example 'g0', 'g1', and 'g2' for
                three subfilters and band 'g'."""),
    callback=split_commas,
    required=True,
    nargs=-1,
)