MolecularDiffusion.utils.file¶
Attributes¶
Functions¶
|
Compute MD5 of the file. |
|
Download a file from the specified url. |
|
Extract files from a zip file. Currently, |
|
Get the number of lines in a file. |
|
Open a regular file or a zipped file. |
Module Contents¶
- MolecularDiffusion.utils.file.compute_md5(file_name, chunk_size=65536)¶
Compute MD5 of the file.
- MolecularDiffusion.utils.file.download(url, path, save_file=None, md5=None)¶
Download a file from the specified url. Skip the downloading step if there exists a file satisfying the given MD5.
- MolecularDiffusion.utils.file.extract(zip_file, member=None)¶
Extract files from a zip file. Currently,
zip,gz,tar.gz,tarfile types are supported.
- MolecularDiffusion.utils.file.get_line_count(file_name, chunk_size=8192 * 1024)¶
Get the number of lines in a file.
- MolecularDiffusion.utils.file.smart_open(file_name, mode='rb')¶
Open a regular file or a zipped file.
This function can be used as drop-in replacement of the builtin function open().
- MolecularDiffusion.utils.file.logger¶