예제 #1
0
def test_sharing_mode():
    "Ensure sharing mode decorator turns on sharing"
    assert not lks.in_share_context()

    with lks.sharing_mode():
        assert lks.in_share_context()

    assert not lks.in_share_context()
예제 #2
0
def store(data, file_name, sharingmode=True):
    full_file_name = Path(get_value("models_folder_path")) / file_name

    if full_file_name.exists():
        os.remove(full_file_name)

    if sharingmode:
        with sharing_mode():
            dump(data, full_file_name, mappable=True)
    else:
        dump(data, full_file_name)
예제 #3
0
def store_model(data, file_name, sharingmode=True):
    if not file_name.count(extension):
        file_name += extension
    full_file_name = Path(directory_path) / file_name

    if full_file_name.exists():
        os.remove(full_file_name)

    if sharingmode:
        with sharing_mode():
            dump(data, full_file_name, mappable=True)
    else:
        dump(data, full_file_name)
예제 #4
0
def store(data, file_name, sharingmode=True):
    models_folder_path = get_value("models_folder_path")
    full_file_name = Path(models_folder_path) / file_name

    if full_file_name.exists():
        os.remove(full_file_name)

    if not os.path.exists(models_folder_path):
        os.makedirs(models_folder_path)

    if sharingmode:
        with sharing_mode():
            dump(data, full_file_name, mappable=True)
    else:
        dump(data, full_file_name)