use snake case for to_unicode
This commit is contained in:
parent
22cb3e1cbd
commit
51239167d3
3 changed files with 16 additions and 16 deletions
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
from datetime import datetime, date, time
|
||||
from weboob.tools.browser import BaseBrowser
|
||||
from weboob.tools.misc import toUnicode
|
||||
from weboob.tools.misc import to_unicode
|
||||
|
||||
class CanalTP(BaseBrowser):
|
||||
DOMAIN = 'widget.canaltp.fr'
|
||||
|
|
@ -36,7 +36,7 @@ class CanalTP(BaseBrowser):
|
|||
except ValueError:
|
||||
continue
|
||||
else:
|
||||
yield _id, toUnicode(name)
|
||||
yield _id, to_unicode(name)
|
||||
|
||||
def iter_station_departures(self, station_id, arrival_id=None):
|
||||
result = self.openurl(u"http://widget.canaltp.fr/Prochains_departs_15122009/dev/index.php?gare=%s" % unicode(station_id)).read()
|
||||
|
|
@ -48,12 +48,12 @@ class CanalTP(BaseBrowser):
|
|||
departure = value
|
||||
elif key.startswith('ligne'):
|
||||
_type, unknown, _time, arrival, served, late, late_reason = value.split(';', 6)
|
||||
yield {'type': toUnicode(_type),
|
||||
yield {'type': to_unicode(_type),
|
||||
'time': datetime.combine(date.today(), time(*[int(x) for x in _time.split(':')])),
|
||||
'departure': toUnicode(departure),
|
||||
'arrival': toUnicode(arrival).strip(),
|
||||
'departure': to_unicode(departure),
|
||||
'arrival': to_unicode(arrival).strip(),
|
||||
'late': late and time(0, int(late.split()[0])) or time(),
|
||||
'late_reason': toUnicode(late_reason).replace('\n', '').strip()}
|
||||
'late_reason': to_unicode(late_reason).replace('\n', '').strip()}
|
||||
|
||||
def home(self):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ from datetime import datetime, date, time
|
|||
import HTMLParser
|
||||
|
||||
from weboob.tools.browser import BaseBrowser
|
||||
from weboob.tools.misc import toUnicode
|
||||
from weboob.tools.misc import to_unicode
|
||||
|
||||
from .pages.route import RoutePage
|
||||
|
||||
|
|
@ -138,13 +138,13 @@ class Transilien(BaseBrowser):
|
|||
_time = None
|
||||
_late_reason = route.time
|
||||
else:
|
||||
yield {'type': toUnicode(route.code_mission),
|
||||
yield {'type': to_unicode(route.code_mission),
|
||||
'time': _time,
|
||||
'departure': toUnicode(station_id),
|
||||
'arrival': toUnicode(route.destination),
|
||||
'departure': to_unicode(station_id),
|
||||
'arrival': to_unicode(route.destination),
|
||||
'late': time(),
|
||||
'late_reason': _late_reason,
|
||||
'plateform': toUnicode(route.platform)}
|
||||
'plateform': to_unicode(route.platform)}
|
||||
|
||||
def home(self):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -22,16 +22,16 @@ import traceback
|
|||
import types
|
||||
|
||||
|
||||
__all__ = ['toUnicode', 'local2utc', 'html2text', 'get_backtrace', 'iter_fields']
|
||||
__all__ = ['to_unicode', 'local2utc', 'html2text', 'get_backtrace', 'iter_fields']
|
||||
|
||||
|
||||
def toUnicode(text):
|
||||
def to_unicode(text):
|
||||
r"""
|
||||
>>> toUnicode('ascii')
|
||||
>>> to_unicode('ascii')
|
||||
u'ascii'
|
||||
>>> toUnicode(u'utf\xe9'.encode('UTF-8'))
|
||||
>>> to_unicode(u'utf\xe9'.encode('UTF-8'))
|
||||
u'utf\xe9'
|
||||
>>> toUnicode(u'unicode')
|
||||
>>> to_unicode(u'unicode')
|
||||
u'unicode'
|
||||
"""
|
||||
if isinstance(text, unicode):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue