Exemplo n.º 1
0
def _parse_flags(argv: List[str]) -> argparse.Namespace:
    """Command lines flag parsing."""
    parser = argparse_flags.ArgumentParser(
        description='Tensorflow Datasets CLI tool', )
    parser.add_argument('--version',
                        action='version',
                        version='TensorFlow Datasets: ' + tfds.__version__)
    parser.set_defaults(subparser_fn=lambda _: parser.print_help())
    # Register sub-commands
    subparser = parser.add_subparsers(title='command')
    new.register_subparser(subparser)
    return parser.parse_args(argv[1:])
Exemplo n.º 2
0
def _parse_flags(argv: List[str]) -> argparse.Namespace:
    """Command lines flag parsing."""
    # Normalize explicit boolean flags for absl.flags compatibility
    # See b/174043007 for context.
    argv = _normalize_flags(argv)

    parser = argparse_flags.ArgumentParser(
        description='Tensorflow Datasets CLI tool', )
    parser.add_argument('--version',
                        action='version',
                        version='TensorFlow Datasets: ' + tfds.__version__)
    parser.set_defaults(subparser_fn=lambda _: parser.print_help())
    # Register sub-commands
    subparser = parser.add_subparsers(title='command')
    build.register_subparser(subparser)
    new.register_subparser(subparser)
    return parser.parse_args(argv[1:])