python类REMAINDER的实例源码

main.py 文件源码 项目:ardy 作者: avara1986 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def init_config(self, arguments):
        # TODO: refactor this method... sooo ugly :S
        parser = self.parser_base
        parser.add_argument('args', nargs=argparse.REMAINDER)
        base_parser = parser.parse_args(arguments)

        params = {}
        if getattr(base_parser, "project", False) and base_parser.project is not None:
            params["path"] = base_parser.project

        if getattr(base_parser, "conffile", False) and base_parser.conffile is not None:
            params["filename"] = base_parser.conffile

        self.config = GlobalConfig(**params)

        return self.parser_base
archive.py 文件源码 项目:bob 作者: BobBuildTool 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def doArchive(argv, bobRoot):
    subHelp = "\n          ... ".join(sorted(
        [ "{:8} {}".format(c, d[1]) for (c, d) in availableArchiveCmds.items() ]))
    parser = argparse.ArgumentParser(prog="bob archive",
        formatter_class=argparse.RawDescriptionHelpFormatter,
        description="""Manage binary artifacts archive. The following subcommands are available:

  bob archive {}
""".format(subHelp))
    parser.add_argument('subcommand', help="Subcommand")
    parser.add_argument('args', nargs=argparse.REMAINDER,
                        help="Arguments for subcommand")

    args = parser.parse_args(argv)

    if args.subcommand in availableArchiveCmds:
        availableArchiveCmds[args.subcommand][0](args.args)
    else:
        parser.error("Unknown subcommand '{}'".format(args.subcommand))
gcc_compile_wrapper.py 文件源码 项目:nojs 作者: chrisdickinson 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def main():
  parser = argparse.ArgumentParser(description=__doc__)
  parser.add_argument('--resource-whitelist',
                      help='Generate a resource whitelist for this target.',
                      metavar='PATH')
  parser.add_argument('command', nargs=argparse.REMAINDER,
                      help='Compilation command')
  args = parser.parse_args()

  returncode, stderr = wrapper_utils.CaptureCommandStderr(
      wrapper_utils.CommandToRun(args.command))

  used_resources = wrapper_utils.ExtractResourceIdsFromPragmaWarnings(stderr)
  sys.stderr.write(stderr)

  if args.resource_whitelist:
    with open(args.resource_whitelist, 'w') as f:
      if used_resources:
        f.write('\n'.join(str(resource) for resource in used_resources))
        f.write('\n')

  return returncode
__init__.py 文件源码 项目:PySketch 作者: IGBC 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def main():
    parser = argparse.ArgumentParser(description='PySketch - Write easy sketches in python.\n'
                                                 'Add "#!/usr/bin/env pysketch" to a sketchfile and make it executable to run from the shell')
    parser.add_argument('sketchfile', type=str, help="file to load and execute")
    parser.add_argument('sketch arguments', nargs=argparse.REMAINDER, help="arguments to the sketch")
    parser.add_argument('-v, --version', action='version', version=__version__)
    # Set up logger
    logger = logging.getLogger('sketches')
    ch = logging.StreamHandler()
    formatter = logging.Formatter('[%(levelname)s]: %(message)s')
    ch.setFormatter(formatter)
    logger.addHandler(ch)

    args = parser.parse_args().__dict__
    try:
        runner = SketchRunner(args['sketchfile'])
    except FileNotFoundError:
        exit()

    runner.run(args['sketch arguments'])
mx.py 文件源码 项目:mx 作者: graalvm 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def ideinit(args, refreshOnly=False, buildProcessorJars=True):
    """(re)generate IDE project configurations"""
    parser = ArgumentParser(prog='mx ideinit')
    parser.add_argument('--no-python-projects', action='store_false', dest='pythonProjects', help='Do not generate projects for the mx python projects.')
    parser.add_argument('remainder', nargs=REMAINDER, metavar='...')
    args = parser.parse_args(args)
    mx_ide = os.environ.get('MX_IDE', 'all').lower()
    all_ides = mx_ide == 'all'
    if all_ides or mx_ide == 'eclipse':
        eclipseinit(args.remainder, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars, doFsckProjects=False, pythonProjects=args.pythonProjects)
    if all_ides or mx_ide == 'netbeans':
        netbeansinit(args.remainder, refreshOnly=refreshOnly, buildProcessorJars=buildProcessorJars, doFsckProjects=False)
    if all_ides or mx_ide == 'intellij':
        intellijinit(args.remainder, refreshOnly=refreshOnly, doFsckProjects=False, mx_python_modules=args.pythonProjects)
    if not refreshOnly:
        fsckprojects([])
test_net.py 文件源码 项目:TensorFlow-ADGM 作者: dancsalo 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def parse_args():
    """
    Parse input arguments
    """
    parser = argparse.ArgumentParser(description='Test a ADGM Network')
    parser.add_argument('--cfg', dest='cfg_file',
                        help='optional config file', default=None, type=str)
    parser.add_argument('--dataset', dest='dataset',
                        help='dataset to test',
                        default='voc_2007_test', type=str)
    parser.add_argument('--tag', dest='tag',
                        help='tag of the model',
                        default='', type=str)
    parser.add_argument('--set', dest='set_cfgs',
                        help='set config keys', default=None,
                        nargs=argparse.REMAINDER)

    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(1)

    args = parser.parse_args()
    return args
gcc_compile_wrapper.py 文件源码 项目:chromium-build 作者: discordapp 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def main():
  parser = argparse.ArgumentParser(description=__doc__)
  parser.add_argument('--resource-whitelist',
                      help='Generate a resource whitelist for this target.',
                      metavar='PATH')
  parser.add_argument('command', nargs=argparse.REMAINDER,
                      help='Compilation command')
  args = parser.parse_args()

  returncode, stderr = wrapper_utils.CaptureCommandStderr(
      wrapper_utils.CommandToRun(args.command))

  used_resources = wrapper_utils.ExtractResourceIdsFromPragmaWarnings(stderr)
  sys.stderr.write(stderr)

  if args.resource_whitelist:
    with open(args.resource_whitelist, 'w') as f:
      if used_resources:
        f.write('\n'.join(str(resource) for resource in used_resources))
        f.write('\n')

  return returncode
pidproxy.py 文件源码 项目:ansible-symphony 作者: istresearch 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("pidfile", help="pid file location")
    parser.add_argument("command", help="command to run (with args)", nargs=argparse.REMAINDER)
    parser.add_argument("--daemon", "-d", help="handle proxies processes which fork to background and terminate "
                                               "by waiting for a valid pid file, then monitor the pid in order "
                                               "to track the process lifetime", action="store_true")
    parser.add_argument("--start-wait", "-s", help="amount of seconds to wait for a valid pid file to appear "
                                                   "(default: 60, ignored if not using --daemon)",
                        default=60, type=int)
    params = parser.parse_args()
    wait_pidfile_time=None
    if params.daemon:
        wait_pidfile_time = params.start_wait
    pp = PidProxy(pidfile=params.pidfile, cmdargs=params.command, wait_pidfile_time=wait_pidfile_time)
    pp.go()
google.py 文件源码 项目:gcp-tools 作者: lukwam 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def auth_stored_credentials(self, client_secrets_file, scopes=[]):
        """Authorize stored credentials."""
        try:
            import argparse
            parser = argparse.ArgumentParser(parents=[tools.argparser])
            parser.add_argument('args', nargs=argparse.REMAINDER)
            flags = parser.parse_args()
            flags.noauth_local_webserver = True
        except ImportError:
            flags = None
        store = Storage(self.credentials_file)
        credentials = store.get()
        if not credentials or credentials.invalid:
            flow = client.flow_from_clientsecrets(
                client_secrets_file,
                scopes,
            )
            flow.user_agent = self.app_name
            if flags:
                credentials = tools.run_flow(flow, store, flags)
            else:  # Needed only for compatibility with Python 2.6
                credentials = tools.run(flow, store)
            print 'Saved credentials to ' + self.credentials_file
        return credentials
containers.py 文件源码 项目:python-zunclient 作者: openstack 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def get_parser(self, prog_name):
        parser = super(ExecContainer, self).get_parser(prog_name)
        parser.add_argument(
            'container',
            metavar='<container>',
            help='ID or name of the container to execute command in.')
        parser.add_argument(
            'command',
            metavar='<command>',
            nargs=argparse.REMAINDER,
            help='The command to execute.')
        parser.add_argument(
            '--interactive',
            dest='interactive',
            action='store_true',
            default=False,
            help='Keep STDIN open and allocate a pseudo-TTY for interactive')
        return parser
entry_point.py 文件源码 项目:cinch 作者: RedHatQE 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def cinch_generic(playbook):
    # Parse the command line arguments
    parser = ArgumentParser(description='A wrapper around Cinch for the most '
                            'common use case')
    # The inventory file that the user provides which will get passed along to
    # Ansible for its consumption
    parser.add_argument('inventory')
    # All remaining arguments are passed through, untouched, to Ansible
    parser.add_argument('args', nargs=REMAINDER)
    args = parser.parse_args()
    if len(args.inventory) > 0:
        if args.inventory[0] == '/':
            inventory = args.inventory
        else:
            inventory = path.join(getcwd(), args.inventory)
    else:
        raise Exception('Inventory path needs to be non-empty')
    exit_code = call_ansible(inventory, playbook, args.args)
    sys.exit(exit_code)
gcc_compile_wrapper.py 文件源码 项目:gn-build 作者: timniederhausen 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def main():
  parser = argparse.ArgumentParser(description=__doc__)
  parser.add_argument('--resource-whitelist',
                      help='Generate a resource whitelist for this target.',
                      metavar='PATH')
  parser.add_argument('command', nargs=argparse.REMAINDER,
                      help='Compilation command')
  args = parser.parse_args()

  returncode, stderr = wrapper_utils.CaptureCommandStderr(
      wrapper_utils.CommandToRun(args.command))

  used_resources = wrapper_utils.ExtractResourceIdsFromPragmaWarnings(stderr)
  sys.stderr.write(stderr)

  if args.resource_whitelist:
    with open(args.resource_whitelist, 'w') as f:
      if used_resources:
        f.write('\n'.join(str(resource) for resource in used_resources))
        f.write('\n')

  return returncode
gcc_compile_wrapper.py 文件源码 项目:gn_build 作者: realcome 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def main():
  parser = argparse.ArgumentParser(description=__doc__)
  parser.add_argument('--resource-whitelist',
                      help='Generate a resource whitelist for this target.',
                      metavar='PATH')
  parser.add_argument('command', nargs=argparse.REMAINDER,
                      help='Compilation command')
  args = parser.parse_args()

  returncode, stderr = wrapper_utils.CaptureCommandStderr(
      wrapper_utils.CommandToRun(args.command))

  used_resources = wrapper_utils.ExtractResourceIdsFromPragmaWarnings(stderr)
  sys.stderr.write(stderr)

  if args.resource_whitelist:
    with open(args.resource_whitelist, 'w') as f:
      if used_resources:
        f.write('\n'.join(str(resource) for resource in used_resources))
        f.write('\n')

  return returncode
external.py 文件源码 项目:papis 作者: alejandrogallo 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def init(self, path):
        self.script_path = path

        self.parser = self.get_subparsers().add_parser(
            self.get_command_name(),
            add_help=False,
            help=self.get_command_help()
        )

        self.parser.add_argument(
            "-h", "--help",
            action="store_true"
        )

        self.parser.add_argument(
            "args",
            help="Arguments",
            nargs=argparse.REMAINDER,
            action="store"
        )
paladin-plugins.py 文件源码 项目:paladin-plugins 作者: twestbrookunh 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def parseArguments():
    argParser = argparse.ArgumentParser(description='PALADIN Pipeline Plugins')
    argParser.add_argument('-l', dest='list', action='store_true', help='List available plugins') 
    argParser.add_argument('plugins', metavar='Plugins', type=str, nargs=argparse.REMAINDER, help='Plugin with arguments (@@plugin arguments)')

    retArguments = argParser.parse_args()

    # Check for no arguments, or bad syntax in plugins list
    invalidArgs = False
    if not retArguments.list and not retArguments.plugins: invalidArgs = True
    if retArguments.plugins and not retArguments.plugins[0].startswith('@@'): invalidArgs = True

    if invalidArgs:
        argParser.print_help()
        sys.exit(1)

    # Replace quotes for strings with spaces
    for plugIdx in range(len(retArguments.plugins)):
        plugArg = retArguments.plugins[plugIdx]
        if ' ' in plugArg: plugArg = "\"{0}\"".format(plugArg)
        retArguments.plugins[plugIdx] = plugArg

    return retArguments

# Extract pipeline plugin/argument pairs from arguments
automate.py 文件源码 项目:paladin-plugins 作者: twestbrookunh 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def automateMain(passArguments):
    # Parse arguments 
    argParser = argparse.ArgumentParser(description='PALADIN Pipeline Plugins: Automate', prog='automate')
    argParser.add_argument('reference', metavar='REFERENCE', type=str, help='Reference database')
    argParser.add_argument('root', metavar='ROOT', type=str, help='Root path to search') 
    argParser.add_argument('pattern', metavar='PATTERN', type=str, help='Input reads search pattern')
    argParser.add_argument('options', metavar='OPTIONS', type=str, nargs=argparse.REMAINDER, help='PALADIN options')
    arguments = argParser.parse_known_args(shlex.split(passArguments))

    for root, dirs, files in os.walk(arguments[0].root):
        for fileName in files:
            if not re.search(arguments[0].pattern, fileName): continue

            # Matching input sequence, execute PALADIN
            baseName = fileName
            if '.' in baseName: baseName = baseName[:baseName.index('.')]
            baseName = os.path.join(root, baseName)
            fullFile = os.path.join(root, fileName) 

            command = "paladin align {0} {1} -o {2} {3}".format(arguments[0].reference, fullFile, baseName, ' '.join(arguments[0].options))
            output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True)

            with open("{0}.log".format(baseName), 'wb') as fileHandle:
                fileHandle.write(output)
main.py 文件源码 项目:potstill 作者: fabianschuiki 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def mainChar(argv):

    parser = argparse.ArgumentParser(
        description="Perform characterization for memory macros.",
        prog="char"
    )
    parser.add_argument("num_addr", metavar="NADDR", type=int, help="number of address lines")
    parser.add_argument("num_bits", metavar="NBITS", type=int, help="number of bits")
    parser.add_argument("char", metavar="CHAR", type=str, help="characterization to perform")
    parser.add_argument("--vdd", metavar="VDD", type=float, default=1.2, help="supply voltage [V]")
    parser.add_argument("--temp", metavar="T", type=float, default=25, help="junction temperature [°C]")
    parser.add_argument("args", nargs=argparse.REMAINDER)
    args = parser.parse_args(argv)

    macro = potstill.macro.MacroConditions(args.num_addr, args.num_bits, vdd=args.vdd, temp=args.temp)

    if args.char == "all":
        mainCharMacroAll(macro, args.args)
    else:
        mainCharMacro(macro, args.char, args.args)
gsutil.py 文件源码 项目:Chromium_DepotTools 作者: p07r0457 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def parse_args():
  bin_dir = os.environ.get('DEPOT_TOOLS_GSUTIL_BIN_DIR', DEFAULT_BIN_DIR)

  parser = argparse.ArgumentParser()
  parser.add_argument('--force-version', default='4.13')
  parser.add_argument('--clean', action='store_true',
      help='Clear any existing gsutil package, forcing a new download.')
  parser.add_argument('--fallback', default=DEFAULT_FALLBACK_GSUTIL)
  parser.add_argument('--target', default=bin_dir,
      help='The target directory to download/store a gsutil version in. '
           '(default is %(default)s).')
  parser.add_argument('args', nargs=argparse.REMAINDER)

  args, extras = parser.parse_known_args()
  if args.args and args.args[0] == '--':
    args.args.pop(0)
  if extras:
    args.args = extras + args.args
  return args
gsutil.py 文件源码 项目:node-gn 作者: Shouqun 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def parse_args():
  bin_dir = os.environ.get('DEPOT_TOOLS_GSUTIL_BIN_DIR', DEFAULT_BIN_DIR)

  parser = argparse.ArgumentParser()
  parser.add_argument('--force-version', default='4.13')
  parser.add_argument('--clean', action='store_true',
      help='Clear any existing gsutil package, forcing a new download.')
  parser.add_argument('--fallback', default=DEFAULT_FALLBACK_GSUTIL)
  parser.add_argument('--target', default=bin_dir,
      help='The target directory to download/store a gsutil version in. '
           '(default is %(default)s).')
  parser.add_argument('args', nargs=argparse.REMAINDER)

  args, extras = parser.parse_known_args()
  if args.args and args.args[0] == '--':
    args.args.pop(0)
  if extras:
    args.args = extras + args.args
  return args
php_cli.py 文件源码 项目:Deploy_XXNET_Server 作者: jzp820927 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def _create_command_line_parser():
  """Returns an argparse.ArgumentParser to parse command line arguments."""
  parser = argparse.ArgumentParser(
      usage='usage: %(prog)s [execution options] <script> [script_args]',
      formatter_class=argparse.ArgumentDefaultsHelpFormatter)
  parser.add_argument(
      'script',
      help='the path to the PHP script that should be executed')
  parser.add_argument(
      'script_args',
      help='the command arguments that will be passed to the script',
      nargs=argparse.REMAINDER)

  execution_group = parser.add_argument_group('Execution Options')

  php_cli_path = _get_default_php_cli_path()
  execution_group.add_argument('--php_executable_path', metavar='PATH',
                               type=_parse_path,
                               default=php_cli_path,
                               required=php_cli_path is None,
                               help='path to the PHP executable')
  return parser
test.py 文件源码 项目:USTC-Software-2017 作者: igemsoftware2017 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def add_arguments(self, parser):
        parser.add_argument(
            'files',
            nargs=argparse.REMAINDER,
            help='You may specify the test files/directories to be executed.'
        )
        parser.add_argument(
            '--recreate',
            action='store_true',
            dest='recreate',
            default=False,
            help='Recreate test database (will slow down the test process), '
            'used when the database schema changed.'
        )
        parser.add_argument(
            '--capture-stdout', '-cs',
            action='store_true',
            default=False,
            dest='capture_stdout',
            help='Tell pytest to capture stdout when certain tests fail.')
Honey.py 文件源码 项目:PBSuite 作者: dbrowneup 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def parseArgs():
    parser = argparse.ArgumentParser(prog="Honey.py", description=USAGE, \
            formatter_class=argparse.RawDescriptionHelpFormatter)

    #parser.add_argument("-h", "--help", action="store_true")
    parser.add_argument("stage", metavar="STAGE", choices=STAGES.keys(), type=str, \
                        help="Stage to execute")
    parser.add_argument("options", metavar="OPTIONS", nargs=argparse.REMAINDER,\
                         help="Options to pass to the stage")

    args = parser.parse_args()

    sys.stderr.write("""
Please Cite: English, Adam C., William J. Salerno, Jeffery G.
             Reid. "PBHoney: identyfying genomic variants via
             long-read discordance and interrupted mapping."
             BMC Bioinformatics 2014, 15:180 (June 10, 2014).
             doi:10.1186/1471-2105-15-180\n\n""")

    STAGES[args.stage](args.options)
Honey.py 文件源码 项目:PBSuite 作者: dbrowneup 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def parseArgs():
    parser = argparse.ArgumentParser(prog="Honey.py", description=USAGE, \
            formatter_class=argparse.RawDescriptionHelpFormatter)

    #parser.add_argument("-h", "--help", action="store_true")
    parser.add_argument("stage", metavar="STAGE", choices=STAGES.keys(), type=str, \
                        help="Stage to execute")
    parser.add_argument("options", metavar="OPTIONS", nargs=argparse.REMAINDER,\
                         help="Options to pass to the stage")

    args = parser.parse_args()

    sys.stderr.write("""
Please Cite: English, Adam C., William J. Salerno, Jeffery G.
             Reid. "PBHoney: identyfying genomic variants via
             long-read discordance and interrupted mapping."
             BMC Bioinformatics 2014, 15:180 (June 10, 2014).
             doi:10.1186/1471-2105-15-180\n\n""")

    STAGES[args.stage](args.options)
demo.py 文件源码 项目:PVANet-FACE 作者: twmht 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def parse_args():
    """Parse input arguments."""
    parser = argparse.ArgumentParser(description='Faster R-CNN demo')
    parser.add_argument('--cfg', dest='cfg_file',
                        help='optional config file', default=None, type=str)
    parser.add_argument('--def', dest='prototxt',
                        help='prototxt file defining the network',
                        default=None, type=str)
    parser.add_argument('--net', dest='caffemodel',
                        help='model to test',
                        default=None, type=str)
    parser.add_argument('--gpu', dest='gpu_id', help='GPU id to use',
                        default=0, type=int)
    parser.add_argument('--set', dest='set_cfgs',
                        help='set config keys', default=None,
                        nargs=argparse.REMAINDER)

    args = parser.parse_args()

    return args
cli.py 文件源码 项目:stl 作者: pavelsof 项目源码 文件源码 阅读 43 收藏 0 点赞 0 评论 0
def _init_start(self):
        """
        Inits the subparser that handles the start command.
        """
        def start(core, args):
            task = ' '.join(args.task) if args.task else ''
            return core.start(task=task)

        usage = 'stl start [task]'
        desc = (
            'make a log that you are starting to work'
        )

        subp = self.subparsers.add_parser('start', usage=usage,
            description=desc, help=desc)

        subp.add_argument('task', nargs=argparse.REMAINDER,
            help='the task that you are about to start working on')

        subp.set_defaults(func=start)
cli.py 文件源码 项目:stl 作者: pavelsof 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def _init_switch(self):
        """
        Inits the subparser that handles the switch command.
        """
        def switch(core, args):
            task = ' '.join(args.task) if args.task else ''
            return core.switch(task=task)

        usage = 'stl switch [task]'
        desc = (
            'shortcut for stl stop && stl start; '
            'stop the current task and immediately start another one'
        )

        subp = self.subparsers.add_parser('switch', usage=usage,
            description=desc, help=desc[:desc.find(';')])

        subp.add_argument('task', nargs=argparse.REMAINDER,
            help='the task that you are about to start working on')

        subp.set_defaults(func=switch)
cli.py 文件源码 项目:stl 作者: pavelsof 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _init_edit(self):
        """
        Inits the subparser that handles the edit command.
        """
        def edit(core, args):
            month = ' '.join(getattr(args, 'month', []))
            core.edit(month)

        usage = 'stl edit [month]'
        desc = (
            'lets you vim the right file'
        )

        subp = self.subparsers.add_parser('edit', usage=usage,
            description=desc, help=desc)

        subp.add_argument('month', nargs=argparse.REMAINDER,
            help='the month you want to edit, e.g. oct 2016')

        subp.set_defaults(func=edit)
__main__.py 文件源码 项目:videoscreen 作者: SFTtech 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def main():
    """ launch the screen """

    cli = argparse.ArgumentParser()
    cli.add_argument("-p", "--port", default=60601,
                     type=int, help="port to listen on")
    cli.add_argument("-l", "--listen", default="0.0.0.0",
                     help="ip to listen on")
    cli.add_argument("-m", "--music", action="store_true",
                     help="control mpd player by pausing and unpausing")
    cli.add_argument("--mpdhost", default=None,
                     help="server where mpd is reached")
    cli.add_argument("--mpdport", default=None,
                     help="port where mpd is reached")
    cli.add_argument("options", default="", nargs=argparse.REMAINDER,
                     help="mpv options")

    args = cli.parse_args()

    screen = VideoScreen(args)
    screen.launch()
bin.py 文件源码 项目:fccforensics 作者: RagtagOpen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def main():
    parser = argparse.ArgumentParser(description='Run commands to index and analyze FCC comments')
    parser.add_argument('command', choices=['index', 'analyze', 'create', 'tag_sigterms', 'breached'])
    parser.add_argument('args', nargs=argparse.REMAINDER)

    args = parser.parse_args()

    {
        'create': create_command,
        'index': index_command,
        'analyze': analyze_command,
        'tag_sigterms': positive_sig_terms_command,
        'breached': breached_command
    }[args.command](args.args)
test_net.py 文件源码 项目:HandDetection 作者: YunqiuXu 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def parse_args():
  """
  Parse input arguments
  """
  parser = argparse.ArgumentParser(description='Test a Fast R-CNN network')
  parser.add_argument('--cfg', dest='cfg_file',
            help='optional config file', default=None, type=str)
  parser.add_argument('--model', dest='model',
            help='model to test',
            default=None, type=str)
  parser.add_argument('--imdb', dest='imdb_name',
            help='dataset to test',
            default='voc_2007_test', type=str)
  parser.add_argument('--comp', dest='comp_mode', help='competition mode',
            action='store_true')
  parser.add_argument('--num_dets', dest='max_per_image',
            help='max number of detections per image',
            default=100, type=int)
  parser.add_argument('--tag', dest='tag',
                        help='tag of the model',
                        default='', type=str)
  parser.add_argument('--net', dest='net',
                      help='vgg16, res50, res101, res152, mobile',
                      default='res50', type=str)
  parser.add_argument('--set', dest='set_cfgs',
                        help='set config keys', default=None,
                        nargs=argparse.REMAINDER)

  if len(sys.argv) == 1:
    parser.print_help()
    sys.exit(1)

  args = parser.parse_args()
  return args


问题


面经


文章

微信
公众号

扫码关注公众号