create utils module

This commit is contained in:
WorldTeacher
2024-01-31 15:20:40 +01:00
parent cf7f0df434
commit 69e7d7a0de
4 changed files with 21 additions and 0 deletions

2
src/utils/__init__.py Normal file
View File

@@ -0,0 +1,2 @@
from .pickles import load_pickle, dump_pickle
from .blob import create_blob

9
src/utils/blob.py Normal file
View File

@@ -0,0 +1,9 @@
def create_blob(file):
"""
Creates a blob from a file.
"""
with open(file, "rb") as f:
blob = f.read()
return blob

6
src/utils/pickles.py Normal file
View File

@@ -0,0 +1,6 @@
import pickle
def load_pickle(data):
return pickle.loads(data)
def dump_pickle(data):
return pickle.dumps(data)

4
src/utils/temp.py Normal file
View File

@@ -0,0 +1,4 @@
template = "{{sap{}_prof}} ({{sap_{}_name}})"
result = "\n".join(template.format(i, i) for i in range(1, 201))
print(result)