Skip to content

Demo Files Installer Sub-Module

t3co.utils.demo_inputs_installer

main()

Requests user inputs for whether and where to copy t3co demo input files from the t3co.resources folder. Calls the copy_demo_input_files function.

Source code in src/t3co/utils/demo_inputs_installer.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
def main():
    """
    Requests user inputs for whether and where to copy t3co demo input files from the t3co.resources folder. Calls the copy_demo_input_files function.
    """
    choice = (
        input("Do you want to copy the t3co demo input files? (y/n): ").strip().lower()
    )
    if choice == "y":
        destination_path = input(
            "Enter the path where you want to copy demo input files: "
        ).strip()
        copy_demo_input_files(destination_path)
    else:
        print("Demo input files were not copied.")

copy_demo_input_files(destination_path)

Copies the t3co.resources folder that includes demo input files to a user input destination_path.

Parameters:

Name Type Description Default
destination_path Union[str, Path]

Path of destination directory for copying t3co.resources folder.

required
Source code in src/t3co/utils/demo_inputs_installer.py
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
def copy_demo_input_files(destination_path: Union[str, Path]) -> None:
    """
    Copies the t3co.resources folder that includes demo input files to a user input destination_path.

    Args:
        destination_path (Union[str, Path]): Path of destination directory for copying t3co.resources folder.
    """
    source_path = Path(__file__).parents[1] / "resources"
    destination_path = Path(destination_path) / "demo_inputs"

    if not destination_path.exists():
        os.makedirs(destination_path)

    for item in source_path.iterdir():
        if item.is_file():
            shutil.copy(item, destination_path / item.name)
        else:
            shutil.copytree(item, destination_path / item.name)
    print(f"t3co demo input files copied to {destination_path.resolve()}")