Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds mkdir file_util #11

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions twang/util/file_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def file_exists(file_path: str) -> bool:
return Path(file_path).exists()


def mkdir(dir_path: str):
path = CloudPath(dir_path) if _is_cloud_path(dir_path) else Path(dir_path)
path.mkdir(parents=True, exist_ok=True)


def load_pickle(file_path: str, **kwargs) -> Any:
"""Load a pickled object from a given file_path, either local or cloud."""
path = CloudPath(file_path) if _is_cloud_path(file_path) else Path(file_path)
Expand Down
Loading