-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
""" Implementation of mooda """ | ||
from .waterframe import WaterFrame | ||
from .input import read_nc_emodnet, read_nc, read_nc_imos, read_pkl | ||
from .util import concat, iplot_location, iplot_timeseries | ||
from .util import concat, iplot_location, iplot_timeseries, md5 | ||
|
||
__version__ = '1.1.3' | ||
__version__ = '1.2.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
""" Implementation of util """ | ||
from .concat import concat | ||
from .iplot import iplot_location | ||
from .iplot import iplot_timeseries | ||
from .iplot import iplot_location, iplot_timeseries | ||
from .md5 import md5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" Implementation of md.md5 """ | ||
import hashlib | ||
|
||
|
||
def md5(file_path, save_dm5=True, md5_path=None): | ||
""" | ||
It generates the MD5 code of the input file. | ||
It saves the code into a file if it save_md5 is True. | ||
It saves the code into the text file of 'md5_path'. | ||
If md5_path is None, the name of the file is the same of the input file | ||
with the md5 extension. | ||
""" | ||
|
||
# Make the MD5 code | ||
haser = hashlib.md5() | ||
with open(file_path, 'rb') as open_file: | ||
content = open_file.read() | ||
haser.update(content) | ||
|
||
if save_dm5: | ||
if md5_path: | ||
filename_md5 = md5_path | ||
else: | ||
# Get the same path but with md5 extension | ||
parts = file_path.split('.') | ||
filename_md5 = "" | ||
for part in parts[:-1]: | ||
filename_md5 += part | ||
filename_md5 += ".md5" | ||
|
||
# Save the md5 code into the file | ||
with open(filename_md5, 'w') as open_file: | ||
open_file.write(haser.hexdigest()) | ||
|
||
return haser.hexdigest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters