From 577b0e5aca00a532d5b3471b3fff34b338507a34 Mon Sep 17 00:00:00 2001 From: Joshua Roesslein Date: Sat, 17 Aug 2013 13:37:03 -0700 Subject: [PATCH] Remove some dead util code. --- tweepy/models.py | 3 +-- tweepy/utils.py | 36 +----------------------------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/tweepy/models.py b/tweepy/models.py index 3442790..0f10249 100644 --- a/tweepy/models.py +++ b/tweepy/models.py @@ -3,8 +3,7 @@ # See LICENSE for details. from tweepy.error import TweepError -from tweepy.utils import parse_datetime, parse_html_value, parse_a_href, \ - parse_search_datetime, unescape_html +from tweepy.utils import parse_datetime, parse_html_value, parse_a_href class ResultSet(list): diff --git a/tweepy/utils.py b/tweepy/utils.py index 6f47f36..7c2d498 100644 --- a/tweepy/utils.py +++ b/tweepy/utils.py @@ -14,6 +14,7 @@ from email.utils import parsedate def parse_datetime(string): return datetime(*(parsedate(string)[:6])) + def parse_html_value(html): return html[html.find('>')+1:html.rfind('<')] @@ -26,41 +27,6 @@ def parse_a_href(atag): return atag[start:end] -def parse_search_datetime(string): - # Set locale for date parsing - locale.setlocale(locale.LC_TIME, 'C') - - # We must parse datetime this way to work in python 2.4 - date = datetime(*(time.strptime(string, '%a, %d %b %Y %H:%M:%S +0000')[0:6])) - - # Reset locale back to the default setting - locale.setlocale(locale.LC_TIME, '') - return date - - -def unescape_html(text): - """Created by Fredrik Lundh (http://effbot.org/zone/re-sub.htm#unescape-html)""" - def fixup(m): - text = m.group(0) - if text[:2] == "&#": - # character reference - try: - if text[:3] == "&#x": - return unichr(int(text[3:-1], 16)) - else: - return unichr(int(text[2:-1])) - except ValueError: - pass - else: - # named entity - try: - text = unichr(htmlentitydefs.name2codepoint[text[1:-1]]) - except KeyError: - pass - return text # leave as is - return re.sub("&#?\w+;", fixup, text) - - def convert_to_utf8_str(arg): # written by Michael Norton (http://docondev.blogspot.com/) if isinstance(arg, unicode): -- 2.25.1