push
travis-ci
34 of 34 new or added lines in 4 files covered. (100.0%)
173 of 227 relevant lines covered (76.21%)
1.45 hits per line
1 |
"""
|
|
2 |
An attempt to support both py2 and py3 |
|
3 |
"""
|
|
|
import sys |
2✔ |
5 |
|
|
6 |
|
|
|
PY3 = sys.version_info[0] > 2 |
2✔ |
8 |
|
|
|
if PY3:
|
2✔ |
|
_basestring = str
|
1 only 48.2 ✔ |
|
_range = range
|
1 only 48.2 ✔ |
12 |
|
|
|
def makestring(x): |
1 only 48.2 ✔ |
|
if x is not None: |
1 only 48.2 ✔ |
|
if isinstance(x, bytes): |
1 only 48.2 ✔ |
|
x = x.decode('latin-1')
|
1 only 48.2 ✔ |
|
return x
|
1 only 48.2 ✔ |
18 |
|
|
|
def makebytes(x): |
1 only 48.2 ✔ |
|
if x is not None: |
1 only 48.2 ✔ |
|
if isinstance(x, str): |
1 only 48.2 ✔ |
|
return x.encode('latin-1') |
1 only 48.2 ✔ |
|
return x
|
× |
24 |
else:
|
|
|
_basestring = basestring
|
1 only 48.1 ✔ |
|
_range = xrange
|
1 only 48.1 ✔ |
27 |
|
|
|
def makestring(x): |
1 only 48.1 ✔ |
|
return x
|
1 only 48.1 ✔ |
30 |
|
|
|
def makebytes(x): |
1 only 48.1 ✔ |
|
return x
|
1 only 48.1 ✔ |