mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-14 13:00:10 -06:00
Hashlib doesn't take unicode.
This commit is contained in:
@@ -2,6 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
import contextlib
|
||||
import functools
|
||||
import hashlib
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
@@ -56,3 +57,11 @@ def noop_context():
|
||||
|
||||
def shell_escape(arg):
|
||||
return "'" + arg.replace("'", "'\"'\"'".strip()) + "'"
|
||||
|
||||
|
||||
def hex_md5(s):
|
||||
"""Hexdigest an md5 of the string.
|
||||
|
||||
:param text s:
|
||||
"""
|
||||
return hashlib.md5(s.encode('utf-8')).hexdigest()
|
||||
|
||||
Reference in New Issue
Block a user