MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / confirm_folder_delete

Function confirm_folder_delete

demo/HuggingFace/NNDF/general_utils.py:107–125  ·  view source on GitHub ↗

Confirms whether or not user wants to delete given folder path. Args: fpath (str): Path to folder. prompt (str): Prompt to display Returns: None

(
    fpath: str, prompt: str = "Confirm you want to delete entire folder?"
)

Source from the content-addressed store, hash-verified

105
106# IO #
107def confirm_folder_delete(
108 fpath: str, prompt: str = "Confirm you want to delete entire folder?"
109) -> None:
110 """
111 Confirms whether or not user wants to delete given folder path.
112
113 Args:
114 fpath (str): Path to folder.
115 prompt (str): Prompt to display
116
117 Returns:
118 None
119 """
120 msg = prompt + " {} [Y/n] ".format(fpath)
121 confirm = input(msg)
122 if confirm == "Y":
123 rmtree(fpath)
124 else:
125 G_LOGGER.info("Skipping file removal.")
126
127
128def remove_if_empty(

Callers 3

cleanupMethod · 0.90
cleanupMethod · 0.90
cleanupMethod · 0.90

Calls 1

infoMethod · 0.45

Tested by

no test coverage detected