medcat.storage.zip_utils
Functions:
-
deserialise_from_zip–Deserialise from a zip file.
-
serialise_as_zip–Serialse the file to a .zip at the specified path.
-
should_serialise_as_zip–
deserialise_from_zip
deserialise_from_zip(path: str) -> Serialisable
Deserialise from a zip file.
The process involves unzipping the contents to a temporary directory,
and subsequently using the ruglar deserialise method to deserialise
from that.
Parameters:
-
(pathstr) –The path to deserialise from. Should end with .zip.
Returns:
-
Serialisable(Serialisable) –The deserialised object
Source code in medcat-v2/medcat/storage/zip_utils.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
serialise_as_zip
serialise_as_zip(obj: Serialisable, path: str, ser_type: Union[AvailableSerialisers, str] = dill, overwrite: bool = False) -> None
Serialse the file to a .zip at the specified path.
The process uses the regular serialise method to serialise the object
as a folder into a temporary directory and subsequently zips it up to
the path requested.
Parameters:
-
(objSerialisable) –The object to serialise.
-
(pathstr) –The path to serialse the file to. Should end with .zip.
-
(ser_typeUnion[AvailableSerialisers, str], default:dill) –The serialiser to use. Defaults to AvailableSerialisers.dill.
-
(overwritebool, default:False) –Whether to allow overwriting existing files. Defaults to False.
Source code in medcat-v2/medcat/storage/zip_utils.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
should_serialise_as_zip
Source code in medcat-v2/medcat/storage/zip_utils.py
11 12 13 14 15 16 | |