当前位置: 首页>>代码示例>>Python>>正文


Python commands.Command类代码示例

本文整理汇总了Python中twitter.pants.commands.Command的典型用法代码示例。如果您正苦于以下问题:Python Command类的具体用法?Python Command怎么用?Python Command使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Command类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

  def __init__(self, root_dir, parser, argv):
    Command.__init__(self, root_dir, parser, argv)

    if len(self.args) is not 1:
      self.error("Exactly one BUILD address is required.")

    spec = self.args[0]
    try:
      address = Address.parse(root_dir, spec)
    except IOError:
      self.error("Problem parsing spec %s: %s" % (spec, traceback.format_exc()))

    try:
      self.target = Target.get(address)
    except (ImportError, SyntaxError, TypeError):
      self.error("Problem parsing BUILD target %s: %s" % (address, traceback.format_exc()))

    if not self.target:
      self.error("Target %s does not exist" % address)
开发者ID:JoeEnnever,项目名称:commons,代码行数:19,代码来源:files.py

示例2: _synthesize_command

def _synthesize_command(root_dir, args):
  command = args[0]

  if command in Command.all_commands():
    subcommand_args = args[1:] if len(args) > 1 else []
    return command, _add_default_options(command, subcommand_args)

  if command.startswith('-'):
    _exit_and_fail('Invalid command: %s' % command)

  # assume 'build' if a command was omitted.
  try:
    Address.parse(root_dir, command)
    return _BUILD_COMMAND, _add_default_options(_BUILD_COMMAND, args)
  except:
    _exit_and_fail('Failed to execute pants build: %s' % traceback.format_exc())
开发者ID:CodeWarltz,项目名称:commons,代码行数:16,代码来源:pants_exe.py

示例3: __init__

 def __init__(self, root_dir, parser, args):
   self.targets = []
   Command.__init__(self, root_dir, parser, args)
开发者ID:soheilhy,项目名称:commons,代码行数:3,代码来源:goal.py

示例4: __init__

 def __init__(self, root_dir, parser, args):
   self.targets = []
   # Note that we can't gate this on the self.options.time flag, because self.options is
   # only set up in Command.__init__, and only after it calls setup_parser(), which uses the timer.
   self.timer = Timer()
   Command.__init__(self, root_dir, parser, args)
开发者ID:alaattinturyan,项目名称:commons,代码行数:6,代码来源:goal.py

示例5: _find_all_commands

def _find_all_commands():
  for cmd in Command.all_commands():
    cls = Command.get_command(cmd)
    yield '%s\t%s' % (cmd, cls.__doc__)
开发者ID:avadh,项目名称:commons,代码行数:4,代码来源:pants_exe.py

示例6: _parse_command

def _parse_command(root_dir, args):
  command, args = _synthesize_command(root_dir, args)
  return Command.get_command(command), args
开发者ID:avadh,项目名称:commons,代码行数:3,代码来源:pants_exe.py


注:本文中的twitter.pants.commands.Command类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。