travis-ci
7 of 7 new or added lines in 2 files covered. (100.0%)
528 of 580 relevant lines covered (91.03%)
1.8 hits per line
1 |
import urllib |
2✔ |
2 |
import base64 |
2✔ |
3 |
import sys |
2✔ |
4 |
import re |
2✔ |
5 |
|
|
6 |
|
|
7 |
def is_third(): |
2✔ |
8 |
return sys.version_info >= (3, 0) |
2✔ |
9 |
|
|
10 |
|
|
11 |
def urlencode(s): |
2✔ |
12 |
if hasattr(urllib, 'urlencode'): |
2✔ |
13 |
return urllib.urlencode(s)
|
1 only 56.1 ✔ |
14 |
elif hasattr(urllib, 'parse'): |
1 only 56.2 ✔ |
15 |
return urllib.parse.urlencode(s)
|
1 only 56.2 ✔ |
16 |
else:
|
|
17 |
raise Exception("No urlencode") |
× |
18 |
|
|
19 |
|
|
20 |
def iterator(thing): |
2✔ |
21 |
return thing.iteritems() if hasattr(thing, 'iteritems') else iter(thing.items()) |
2✔ |
22 |
|
|
23 |
|
|
24 |
def base64encode(s): |
2✔ |
25 |
if is_third():
|
2✔ |
26 |
return str(base64.b64encode(bytes(s, 'utf8')), 'utf8') |
1 only 56.2 ✔ |
27 |
else:
|
|
28 |
return base64.b64encode(s)
|
1 only 56.1 ✔ |
29 |
|
|
30 |
|
|
31 |
def tostr(s): |
2✔ |
32 |
if is_third():
|
2✔ |
33 |
return str(s, 'utf8') |
1 only 56.2 ✔ |
34 |
else:
|
|
35 |
return str(s) |
1 only 56.1 ✔ |
36 |
|
|
37 |
|
|
38 |
def clean_decrypted(s): |
2✔ |
39 |
if is_third():
|
2✔ |
40 |
return re.sub(r"[\u0001-\u0010]", '', s).strip() |
1 only 56.2 ✔ |
41 |
else:
|
|
42 |
return s.replace('\x05', '') |
1 only 56.1 ✔ |