(dir)
return uuid_
Generates a unique UUID and checks for collision with files within the
    specified directory (So we don't override a pre-existing file)
Generates a unique UUID and checks for collision with files within the
    specified directory (So we don't override a pre-existing file)
Generates a unique UUID and checks for collision with files within the specified directory ( So we don t override a pre - existing file )
def unique_uuid(dir):
    """Generates a unique UUID and checks for collision with files within the
    specified directory (So we don't override a pre-existing file)"""
    try:
        ls_dir = os.listdir(dir)
    except FileNotFoundError:
        os.makedirs(dir)
        ls_dir = []
    uuid_ = str(uuid.uuid4())[:10]
    while uuid_ + ".json" in ls_dir:
        uuid_ = str(uuid.uuid4())[:10]
    return uuid_
def unique_uuid ( dir ) : try : ls_dir = os . listdir ( dir ) except FileNotFoundError : os . makedirs ( dir ) ls_dir = [ ] uuid_ = str ( uuid . uuid4 ( ) ) [ : 10 ] while uuid_ + ".json" in ls_dir : uuid_ = str ( uuid . uuid4 ( ) ) [ : 10 ] return uuid_