示例#1
0
 def load_serialised_compressed(path: str, title: str) -> Any:
     """Load a serialised object, that was compressed (BZ2 compression).
     :param path: the directory path of the serialised file.
     :param title: the title of the output file.
     :return: the loaded python object.
     """
     reader = PickleSerialised()
     reader.set(path, title, "bz2")
     return reader.load_bz2()
示例#2
0
 def exists_serialised(path: str, title: str, ext: str) -> bool:
     """Check if the serialised object exists.
     :param path: the output directory path.
     :param title: the title of the output file.
     :param ext: the extension of the output file.
     :return: indicates if the file exists.
     """
     reader = PickleSerialised()
     reader.set(path, title, ext)
     return reader.exists()
示例#3
0
 def size_serialised(path: str, title: str, ext: str) -> int:
     """Check the size of the saved file.
     :param path: the directory path of the serialised file.
     :param title: the title of the output file.
     :param ext: the extension of the output file.
     :return: showing stat information of the file.
     """
     reader = PickleSerialised()
     reader.set(path, title, ext)
     return reader.size()
示例#4
0
 def save_serialised_compressed(path: str, title: str, objects: Any):
     """Serialise the object (Pickle protocol=4), then compress (BZ2 compression).
     :param path: the directory path of the serialised file.
     :param title: the title of the output file.
     :param objects: the object to be saved.
     """
     writer = PickleSerialised()
     writer.set(path, title, "bz2")
     writer.save_bz2(objects)
示例#5
0
 def save_serialised(path: str, title: str, objects: Any):
     """Serialise the object (Pickle protocol=4), without compression.
     :param path: the directory path of the serialised file.
     :param title: the title of the output file.
     :param objects: the object to be saved.
     """
     writer = PickleSerialised()
     writer.set(path, title, "pickle")
     writer.save(objects)