X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=patchwork%2Fparser.py;h=13b4466a4b145cfc667018ad804e9a68299c00c4;hb=ed3250d636b024973f527899ee6bc7210ccfb5b4;hp=8afb3348cee38c2c2e9f1eacfd9df26b8bd43ccf;hpb=3b8a61c68fa61eadebf7b19329e8d3bffde9e6b4;p=patchwork diff --git a/patchwork/parser.py b/patchwork/parser.py index 8afb334..13b4466 100644 --- a/patchwork/parser.py +++ b/patchwork/parser.py @@ -20,16 +20,10 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +import hashlib import re from collections import Counter -try: - import hashlib - sha1_hash = hashlib.sha1 -except ImportError: - import sha - sha1_hash = sha.sha - _hunk_re = re.compile('^\@\@ -\d+(?:,(\d+))? \+\d+(?:,(\d+))? \@\@') _filename_re = re.compile('^(---|\+\+\+) (\S+)') @@ -194,7 +188,7 @@ def hash_patch(str): str = str.strip() + '\n' prefixes = ['-', '+', ' '] - hash = sha1_hash() + hash = hashlib.sha1() for line in str.split('\n'):