aboutsummaryrefslogtreecommitdiff
path: root/source/utils.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2012-04-22 10:22:44 +0200
committercedricbonhomme <devnull@localhost>2012-04-22 10:22:44 +0200
commit34fccc4dbee64f34a77cd75b878f3d6a8ae90d57 (patch)
treea6cbeb5de0db639d88758487f680fbe6afee7e0a /source/utils.py
parentSHA1 is replaced by urlsafe_b64encode for id of articles. (diff)
downloadnewspipe-34fccc4dbee64f34a77cd75b878f3d6a8ae90d57.tar.gz
newspipe-34fccc4dbee64f34a77cd75b878f3d6a8ae90d57.tar.bz2
newspipe-34fccc4dbee64f34a77cd75b878f3d6a8ae90d57.zip
Added comments.
Diffstat (limited to 'source/utils.py')
-rwxr-xr-xsource/utils.py17
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):
"""
bgstack15