1+ # (modified by Philip Guo to remove utf-8 dependencies and unnecessary imports)
12import sys
23
34def _print (* args ):
@@ -9,17 +10,17 @@ def _print(*args):
910 PY_VER = '3.x'
1011 from urllib .parse import quote_plus ,parse_qsl
1112 from urllib .request import Request , urlopen , urlretrieve
12- from hashlib import sha1
13- new_sha = lambda s : sha1 (bytes (s ,'utf-8' ))
13+ # from hashlib import sha1
14+ # new_sha = lambda s: sha1(bytes(s,'utf-8'))
1415else :
1516 PY_VER = '2.x'
1617 from urllib import quote_plus ,urlretrieve
1718 from urllib2 import urlopen , Request , URLError , HTTPError
1819 from cgi import parse_qsl
19- try : # >= 2.5
20- from hashlib import sha1 as new_sha
21- except ImportError : # < 2.5
22- from sha import new as new_sha
20+ # try: # >= 2.5
21+ # from hashlib import sha1 as new_sha
22+ # except ImportError: # < 2.5
23+ # from sha import new as new_sha
2324
2425def quote (s ):
2526 try :
@@ -32,8 +33,9 @@ def smart_str(s):
3233 s = quote (s )
3334 except :
3435 pass
35- if PY_VER == '2.x' :
36- return unicode (s ).encode ('utf-8' ) # Py2K
36+ # pgbovine - never use utf-8
37+ #if PY_VER == '2.x':
38+ # return unicode(s).encode('utf-8') # Py2K
3739 return str (s )#.encode('utf-8') # Py3K
3840
3941APIPARAMS = ('chxtc' , 'chxt' , 'chxp' , 'chxs' , 'chxr' , 'chco' , 'chtm' , 'chld' ,
@@ -224,4 +226,4 @@ def smart_str(s):
224226 'shoppingcart' , 'ski' , 'snack' , 'snow' , 'sport' , 'swim' , 'taxi' , 'train' ,
225227 'truck' , 'wheelchair' , 'yen' )
226228BUBBLE_LICONS = ('beer' , 'bike' , 'car' , 'house' , 'petrol' , 'ski' , 'snack' )
227- LEGEND_POSITIONS = ('b' ,'t' ,'r' ,'l' ,'bv' ,'tv' )
229+ LEGEND_POSITIONS = ('b' ,'t' ,'r' ,'l' ,'bv' ,'tv' )
0 commit comments