File tree Expand file tree Collapse file tree 5 files changed +8
-19
lines changed
tensorflow_datasets/scripts Expand file tree Collapse file tree 5 files changed +8
-19
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ def mock_cwd(path: epath.PathLike) -> Iterator[None]:
8383def _build (cmd_flags : str , mock_download_and_prepare : bool = True ) -> List [str ]:
8484 """Executes `tfds build {cmd_flags}` and returns the list of generated ds."""
8585 # Execute the command
86- args = main .parse_flags (f'tfds build { cmd_flags } ' .split ())
86+ args = main ._parse_flags (f'tfds build { cmd_flags } ' .split ())
8787
8888 original_dl_and_prepare = tfds .core .DatasetBuilder .download_and_prepare
8989
@@ -325,7 +325,7 @@ def test_download_only():
325325 ),
326326)
327327def test_make_download_config (args : str , download_config_kwargs ):
328- args = main .parse_flags (f'tfds build x { download_config_kwargs } ' .split ())
328+ args = main ._parse_flags (f'tfds build x { download_config_kwargs } ' .split ())
329329 actual = build_lib ._make_download_config (args , dataset_name = 'x' )
330330 # Ignore the beam runner
331331 actual .replace (beam_runner = None )
Original file line number Diff line number Diff line change 4242FLAGS = flags .FLAGS
4343
4444
45- def parse_flags (argv : List [str ]) -> argparse .Namespace :
45+ def _parse_flags (argv : List [str ]) -> argparse .Namespace :
4646 """Command lines flag parsing."""
4747 argv = flag_utils .normalize_flags (argv ) # See b/174043007 for context.
4848
@@ -102,7 +102,7 @@ def main(args: argparse.Namespace) -> None:
102102
103103def launch_cli () -> None :
104104 """Parse arguments and launch the CLI main function."""
105- app .run (main , flags_parser = parse_flags )
105+ app .run (main , flags_parser = _parse_flags )
106106
107107
108108if __name__ == '__main__' :
Original file line number Diff line number Diff line change @@ -28,4 +28,4 @@ def _check_exit(status=0, message=None):
2828 # Argparse call `sys.exit(0)` when `--version` is passed.
2929 with mock .patch ('sys.exit' , _check_exit ):
3030 version_flag = '--version'
31- main .main (main .parse_flags (['' , version_flag ]))
31+ main .main (main ._parse_flags (['' , version_flag ]))
Original file line number Diff line number Diff line change 2323
2424
2525def _run_cli (cmd : str ) -> None :
26- main .main (main .parse_flags (['' ] + cmd .split ()))
26+ main .main (main ._parse_flags (['' ] + cmd .split ()))
2727
2828
2929def test_new_without_args (capsys ):
Original file line number Diff line number Diff line change 1313# See the License for the specific language governing permissions and
1414# limitations under the License.
1515
16- r"""Wrapper around `tfds build` and `tfds build_croissant` ."""
16+ r"""Wrapper around `tfds build`."""
1717
1818import argparse
1919from typing import List
3535
3636def _parse_flags (argv : List [str ]) -> argparse .Namespace :
3737 """Command lines flag parsing."""
38- parser = argparse .ArgumentParser (
39- description = 'Runs either `tfds build` or `tfds build_croissant`.'
40- )
41- parser .add_argument ('--croissant' , action = 'store_true' )
42- args , other_argv = parser .parse_known_args (argv )
43-
44- if args .croissant :
45- build_cmd = 'build_croissant'
46- else :
47- build_cmd = 'build'
48-
49- return main_cli .parse_flags ([other_argv [0 ], build_cmd ] + other_argv [1 :])
38+ return main_cli ._parse_flags ([argv [0 ], 'build' ] + argv [1 :]) # pylint: disable=protected-access
5039
5140
5241_display_warning = True
You can’t perform that action at this time.
0 commit comments