From a10369db59fcf27503e0d226b3a6c8028e54dbda Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Sat, 17 May 2014 14:59:02 +0200 Subject: [PATCH] Replace deprecated md5 module with hashlib.md5 --- filters/latex/latex2img.py | 11 +++++------ filters/music/music2png.py | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/filters/latex/latex2img.py b/filters/latex/latex2img.py index 238b019..fe1f0d3 100755 --- a/filters/latex/latex2img.py +++ b/filters/latex/latex2img.py @@ -58,11 +58,10 @@ granted under the terms of the MIT License. ''' -# Suppress warning: "the md5 module is deprecated; use hashlib instead" -import warnings -warnings.simplefilter('ignore',DeprecationWarning) - -import os, sys, tempfile, md5 +import hashlib +import os +import sys +import tempfile VERSION = '0.2.0' @@ -132,7 +131,7 @@ def latex2img(infile, outfile, imgfmt, dpi, modified): if infile == '-': tex = sys.stdin.read() if modified: - checksum = md5.new(tex + imgfmt + str(dpi)).digest() + checksum = hashlib.md5(tex + imgfmt + str(dpi)).digest() md5_file = os.path.splitext(outfile)[0] + '.md5' if os.path.isfile(md5_file) and os.path.isfile(outfile) and \ checksum == read_file(md5_file,'rb'): diff --git a/filters/music/music2png.py b/filters/music/music2png.py index a0224df..a3c89ee 100755 --- a/filters/music/music2png.py +++ b/filters/music/music2png.py @@ -50,11 +50,10 @@ granted under the terms of the GNU General Public License (GPL). ''' -# Suppress warning: "the md5 module is deprecated; use hashlib instead" -import warnings -warnings.simplefilter('ignore',DeprecationWarning) - -import os, sys, tempfile, md5 +import hashlib +import os +import sys +import tempfile VERSION = '0.1.2' @@ -103,7 +102,7 @@ def music2png(format, infile, outfile, modified): skip = False if infile == '-': source = sys.stdin.read() - checksum = md5.new(source).digest() + checksum = hashlib.md5(source).digest() filename = os.path.splitext(outfile)[0] + '.md5' if modified: if os.path.isfile(filename) and os.path.isfile(outfile) and \