def _unlock_cache(w_lock):
    if not os.path.exists(w_lock):
        return
    try:
        if os.path.isdir(w_lock):
            os.rmdir(w_lock)
        elif os.path.isfile(w_lock):
            os.unlink(w_lock)
    except (OSError, IOError) as exc:
        log.trace('Error removing lockfile {0}: {1}'.format(w_lock, exc))
Unlock a FS file/dir based lock
dataset/ETHPy150Open saltstack/salt/salt/fileserver/__init__.py/_unlock_cache