Skip to content

Commit

Permalink
fix: Replaced deprecated mktemp() function (huggingface#32123)
Browse files Browse the repository at this point in the history
Replaced deprecated mktemp function.
  • Loading branch information
Sai-Suraj-27 authored and MHRDYN7 committed Jul 23, 2024
1 parent 84d5476 commit 53c534f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions tests/utils/test_image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ def test_load_img_local(self):

def test_load_img_base64_prefix(self):
try:
tmp_file = tempfile.mktemp()
tmp_file = tempfile.NamedTemporaryFile(delete=False).name
with open(tmp_file, "wb") as f:
http_get(
"https://huggingface.co/datasets/hf-internal-testing/dummy-base64-images/raw/main/image_0.txt", f
Expand All @@ -530,7 +530,7 @@ def test_load_img_base64_prefix(self):

def test_load_img_base64(self):
try:
tmp_file = tempfile.mktemp()
tmp_file = tempfile.NamedTemporaryFile(delete=False).name
with open(tmp_file, "wb") as f:
http_get(
"https://huggingface.co/datasets/hf-internal-testing/dummy-base64-images/raw/main/image_1.txt", f
Expand All @@ -547,7 +547,7 @@ def test_load_img_base64(self):

def test_load_img_base64_encoded_bytes(self):
try:
tmp_file = tempfile.mktemp()
tmp_file = tempfile.NamedTemporaryFile(delete=False).name
with open(tmp_file, "wb") as f:
http_get(
"https://huggingface.co/datasets/hf-internal-testing/dummy-base64-images/raw/main/image_2.txt", f
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_tokenization_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_cached_files_are_used_when_internet_is_down_missing_files(self):
def test_legacy_load_from_one_file(self):
# This test is for deprecated behavior and can be removed in v5
try:
tmp_file = tempfile.mktemp()
tmp_file = tempfile.NamedTemporaryFile(delete=False).name
with open(tmp_file, "wb") as f:
http_get("https://huggingface.co/albert/albert-base-v1/resolve/main/spiece.model", f)

Expand Down

0 comments on commit 53c534f

Please sign in to comment.