leap.main module

leap.main.get_parser() argparse.ArgumentParser[source]

Get the command line interface parser.

leap.main.get_config(path_config: str) dict[source]

Get the configuration settings from a json file.

Parameters:
path_config: str

The path to the configuration file.

Returns:

A dictionary containing the configuration settings.

leap.main.handle_output_path(dir_name: str) pathlib.Path | None[source]

Provides path for output data by handling user input through CLI prompts.

  • Assuming WORKSPACE is directory where leap was called, then WORKSPACE/leap_output/dir_name is checked

  • If that path exists then user is prompted to continue (overwriting the current outputs)

  • If that path doesn’t exist then user is prompted whether to create it

Parameters:
dir_name: str

The name of the directory to store the outputs in.

Returns:

Either the path to the output folder, or None, signifying to abort

Examples

(assuming /home/user/WORKSPACE is the currect working directory)

handle_output_path('mydir1')
# assuming the user confirmed to create mydir1
> '/home/user/WORKSPACE/leap_output/mydir1'

handle_output_path('mydir1')
# assuming the user confirmed to continue with existing mydir1
> '/home/user/WORKSPACE/leap_output/mydir1'

handle_output_path('mydir1')
# assuming the user did not confirm to continue with existing mydir1
> None

handle_output_path('mydir2')
# assuming the user did not confirm to create mydir2
> None
leap.main.force_output_path(dir_name: str) pathlib.Path[source]

Provides path for output data without user input.

  • Assuming WORKSPACE is the directory where leap was called, then WORKSPACE/leap_output/dir_name is checked

  • If that path exists then that dir is used (overwriting any existing data)

  • If that path doesn’t exist then is created and used

Parameters:
dir_name: str

The name of the directory to store the outputs in

Returns:

Either the path to the output folder or None, signifying to abort

Examples

(assuming /home/user/WORKSPACE is the currect working directory)

force_output_path('mydir')
> '/home/user/WORKSPACE/leap_output/mydir'
leap.main.run_main()[source]

The entry point for the command line interface.