Slplited python compat file for python 2.x and 3.x
This commit is contained in:
parent
18383549d6
commit
c33a78cdd4
3 changed files with 66 additions and 0 deletions
18
tests/util/py2xfunctions.py
Normal file
18
tests/util/py2xfunctions.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
def b(s):
|
||||
return s
|
||||
|
||||
def l(n):
|
||||
return long(n)
|
||||
|
||||
def unicode_(s):
|
||||
if type(s) == str:
|
||||
import codecs
|
||||
c = codecs.lookup('utf-8')
|
||||
s2 = c.decode(s, 'ignore')
|
||||
return s2[0]
|
||||
return u'%s' % s
|
||||
|
||||
unicode = unicode
|
||||
unichr = unichr
|
||||
long = long
|
||||
buffer = buffer
|
||||
Loading…
Add table
Add a link
Reference in a new issue