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

Use mkstemp to replace deprecated mktemp call #5303

Merged
merged 4 commits into from Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/source/models.rst
Expand Up @@ -805,7 +805,6 @@ and behavior:

# load UCI Adult Data Set; segment it into training and test sets
X, y = shap.datasets.adult()
num_examples = len(X)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)

# train XGBoost model
Expand Down
4 changes: 2 additions & 2 deletions mlflow/utils/file_utils.py
Expand Up @@ -287,7 +287,7 @@ def _filter_timestamps(tar_info):
tar_info.mtime = 0
return tar_info if custom_filter is None else custom_filter(tar_info)

unzipped_filename = tempfile.mktemp()
unzipped_file_handle, unzipped_filename = tempfile.mkstemp()
try:
with tarfile.open(unzipped_filename, "w") as tar:
tar.add(source_dir, arcname=archive_name, filter=_filter_timestamps)
Expand All @@ -298,7 +298,7 @@ def _filter_timestamps(tar_info):
) as gzipped_tar, open(unzipped_filename, "rb") as tar:
gzipped_tar.write(tar.read())
finally:
os.remove(unzipped_filename)
os.close(unzipped_file_handle)


def _copy_project(src_path, dst_path=""):
Expand Down