diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-12-30 21:48:06 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-12-30 21:48:06 +0100 |
commit | ff66a20a0c9c0932f725c10fbb136ab5c6f95e9e (patch) | |
tree | ae82dc1e3fee55e2a21c143a56318a8b0254fd71 | |
parent | Removed strip_accents function. (diff) | |
download | newspipe-ff66a20a0c9c0932f725c10fbb136ab5c6f95e9e.tar.gz newspipe-ff66a20a0c9c0932f725c10fbb136ab5c6f95e9e.tar.bz2 newspipe-ff66a20a0c9c0932f725c10fbb136ab5c6f95e9e.zip |
Removed unescape function.
-rwxr-xr-x | source/utils.py | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/source/utils.py b/source/utils.py index b37ecb8b..a985694b 100755 --- a/source/utils.py +++ b/source/utils.py @@ -92,30 +92,6 @@ def clear_string(data): q = re.compile(b'\s') # consecutive white spaces return p.sub(b'', q.sub(b' ', bytes(data, "utf-8"))).decode("utf-8", "strict") -def unescape(text): - """ - Removes HTML or XML character references and entities from a text string. - """ - def fixup(m): - text = m.group(0) - if text[:2] == "&#": - # character reference - try: - if text[:3] == "&#x": - return chr(int(text[3:-1], 16)) - else: - return chr(int(text[2:-1])) - except ValueError: - pass - else: - # named entity - try: - text = chr(html.entities.name2codepoint[text[1:-1]]) - except KeyError: - pass - return text # leave as is - return re.sub("&#?\w+;", fixup, text) - def normalize_filename(name): """ Normalize a file name. |