fr/fr_env/lib/python3.8/site-packages/imutils/io/tempfile.py

13 lines
313 B
Python
Raw Permalink Normal View History

2021-02-17 12:26:31 +05:30
# import the necessary packages
import uuid
import os
class TempFile:
def __init__(self, basePath="./", ext=".jpg"):
# construct the file path
self.path = "{base_path}/{rand}{ext}".format(base_path=basePath, rand=str(uuid.uuid4()),
ext=ext)
def cleanup(self):
# remove the file
os.remove(self.path)