Skip to content

Commit 9d1bd65

Browse files
committed
Remove warning about deprecated md5 library.
1 parent 6e92ef9 commit 9d1bd65

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

apel/common/hashing.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
'''
16-
17-
import md5
16+
# hashlib only available in python2.5+
17+
try:
18+
from hashlib import md5
19+
except ImportError:
20+
from md5 import md5
1821
import gzip
1922

2023
def calculate_hash(fname):
@@ -28,7 +31,7 @@ def calculate_hash(fname):
2831

2932
data = 'initial'
3033

31-
md = md5.new()
34+
md = md5()
3235

3336
# try opening as a gzip file, and if it fails
3437
# try as a regular file

0 commit comments

Comments
 (0)