def pop_build_root_and_goals(description, args):
  def usage(error_message):
    print(error_message, file=sys.stderr)
    print(dedent("""
    {} {}
    """.format(sys.argv[0])), file=sys.stderr)
    sys.exit(1)

  if 2 < len(args):
    usage('Must supply at least the build root path and one goal.')

  build_root = args.pop(0)

  if not os.path.isdir(build_root):
    usage('First argument must be a valid build root, {} is not a directory.'.format(build_root))
  build_root = os.path.realpath(build_root)

  def is_goal(arg): return os.path.sep not in arg

  goals = [arg for arg in args if is_goal(arg)]
  if not goals:
    usage('Must supply at least one goal.')

  return build_root, goals, [arg for arg in args if not is_goal(arg)]
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/engine/exp/examples/visualizer.py/pop_build_root_and_goals/swapped operands of `<`