def __init__(self, suffix, prefix, dir=None):
    if ('RAM_DISK' in os.environ):
        import uuid
        name = uuid.uuid4().hex
        dir_name = os.path.join(os.environ['RAM_DISK'].strip(), name)
        os.mkdir(dir_name)
        self.name = dir_name
    else:
        self.name = tempfile.mkdtemp(suffix, prefix, dir)
    self._finalizer = finalize(self, self._cleanup, self.name, warn_message='Implicitly cleaning up {!r}'.format(self))
def __init__(self, suffix, prefix, dir=None):
    if ('RAM_DISK' in os.environ):
        import uuid
        name = uuid.uuid4().hex
        dir_name = os.path.join(os.environ['RAM_DISK'].strip(), name)
        os.mkdir(dir_name)
        self.name = dir_name
    else:
        self.name = tempfile.mkdtemp(suffix, prefix, dir)
    self._finalizer = finalize(self, self._cleanup, self.name, warn_message='Implicitly cleaning up {!r}'.format(self))