snipy/io/fileutil.py
def savefile(obj, filepath, compress=True):
    """
    파일 있으면 덮어씀
    :param obj:
    :param str filepath:
    :param compress:
    :return:
    """
    try:
        import cPickle as pickle
    except Exception:
        import pickle
    import joblib

    # 일단 임시 파일에 저장.
    tmpfile = filepath + '.tmp'
    mkdir_if_not(tmpfile)
    if compress:
        joblib.dump(obj, tmpfile, compress=3, cache_size=100, protocol=pickle.HIGHEST_PROTOCOL)
    else:
        joblib.dump(obj, tmpfile, compress=0)

    os.rename(tmpfile, filepath)

    return obj
def savefile(obj, filepath, compress=True):
    """
    파일 있으면 덮어씀
    :param obj:
    :param str filepath:
    :param compress:
    :return:
    """
    try:
        import cPickle as pickle
    except Exception:
        import pickle
    import joblib

    # 일단 임시 파일에 저장.
    tmpfile = filepath + '.tmp'
    mkdir_if_not(tmpfile)
    if compress:
        joblib.dump(obj, tmpfile, compress=3, cache_size=100, protocol=pickle.HIGHEST_PROTOCOL)
    else:
        joblib.dump(obj, tmpfile, compress=0)

    os.rename(tmpfile, filepath)

    return obj
파일 있으면 덮어씀
    :param obj:
    :param str filepath:
    :param compress:
    :return: