diff options
Diffstat (limited to 'source/utils.py')
-rwxr-xr-x | source/utils.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/utils.py b/source/utils.py index 78c909f5..d6365073 100755 --- a/source/utils.py +++ b/source/utils.py @@ -35,7 +35,6 @@ __license__ = "GPLv3" # import re -import hashlib import sqlite3 import operator import urlparse @@ -58,9 +57,6 @@ from collections import OrderedDict from StringIO import StringIO -import threading -LOCKER = threading.Lock() - import os import ConfigParser # load the configuration @@ -94,16 +90,19 @@ url_finders = [ \ re.compile("'\\<((mailto:)|)[-A-Za-z0-9\\.]+@[-A-Za-z0-9\\.]+"), \ ] - from base64 import urlsafe_b64encode, urlsafe_b64decode - - def uri_b64encode(s): - return urlsafe_b64encode(s).strip('=') + """ + Encode an URI in base 64 and remove the final '='. + """ + return urlsafe_b64encode(s).strip('=') def uri_b64decode(s): - return urlsafe_b64decode(s + '=' * (4 - len(s) % 4)) + """ + Decode a base 64 encoded URI. + """ + return urlsafe_b64decode(s + '=' * (4 - len(s) % 4)) def detect_url_errors(list_of_urls): """ |