MCPcopy Create free account
hub / github.com/ResearAI/AutoFigure / ensure_dir

Function ensure_dir

autofigure/utils/file_utils.py:11–23  ·  view source on GitHub ↗

Ensure a directory exists, creating it if necessary. Args: path: Directory path Returns: Path object for the directory

(path: Union[str, Path])

Source from the content-addressed store, hash-verified

9
10
11def ensure_dir(path: Union[str, Path]) -> Path:
12 """
13 Ensure a directory exists, creating it if necessary.
14
15 Args:
16 path: Directory path
17
18 Returns:
19 Path object for the directory
20 """
21 path = Path(path)
22 path.mkdir(parents=True, exist_ok=True)
23 return path
24
25
26def read_text_file(path: Union[str, Path], encoding: str = "utf-8") -> Optional[str]:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected