Jeremy Katz wrote: > On Monday, February 02 2009, Jesse Keating said: >> This patch converts all calls of md5 function to use hashlib if present. >> The old md5 function is deprecated in Python 2.6, and this silences the >> warning messages (along with providing a slight performance improvement). > > Rather than scattering lazy imports in a try except all over the koji > code, I wonder if it's worth adding a wrapper in koji.util and only > doing the try/except once at the module level there. Probably not > speed-critical code, but it would also keep things a little more > readable >
Something like:
[util.py]
try:
from hashlib import md5 as md5_constructor
except ImportError:
from md5 import new as md5_constructor
[other.py]
from koji.util import md5_constructor
digest = md5_constructor(contents).hexdigest()
-Toshio
signature.asc
Description: OpenPGP digital signature
-- Fedora-buildsys-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/fedora-buildsys-list
