Coverage for src/susi/utils/pickle.py: 42%

12 statements  

« prev     ^ index     » next       coverage.py v7.5.0, created at 2025-06-13 14:15 +0000

1#!/usr/bin/env python3 

2# -*- coding: utf-8 -*- 

3""" 

4Functions for reading from and writing to pickle files 

5 

6@author: feller 

7""" 

8 

9import pickle 

10import os 

11 

12 

13def pickle_read(config, file): 

14 pickle_path = os.path.join(config.data.out_path, file) 

15 with open(pickle_path, 'rb') as f: 

16 data = pickle.load(f) 

17 return data 

18 

19 

20def pickle_write(config, file, data): 

21 pickle_path = os.path.join(config.data.out_path, file) 

22 with open(pickle_path, 'wb') as f: 

23 pickle.dump(data, f)