File tree Expand file tree Collapse file tree 6 files changed +9
-9
lines changed Expand file tree Collapse file tree 6 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 2
2
def packed_net_bytes_to_int (b ):
3
3
"""Convert the given big-endian byte-string to an int."""
4
4
return int .from_bytes (b , byteorder = 'big' )
5
- else : # PY2
5
+ else : # pragma: no cover ( PY2)
6
6
def packed_net_bytes_to_int (b ):
7
7
"""Convert the given big-endian byte-string to an int."""
8
8
return int (b .encode ('hex' ), 16 )
Original file line number Diff line number Diff line change 13
13
if hasattr (os , "fsencode" ) and hasattr (os , "fsdecode" ):
14
14
fsencode = os .fsencode
15
15
fsdecode = os .fsdecode
16
- else : # PY2
16
+ else : # pragma: no cover ( PY2)
17
17
import sys
18
18
19
19
def fsencode (path ):
20
- if not isinstance (path , six .binary_type ): # pragma: no cover
20
+ if not isinstance (path , six .binary_type ):
21
21
path = path .encode (sys .getfilesystemencoding ())
22
22
return path
23
23
24
24
def fsdecode (path ):
25
- if not isinstance (path , six .text_type ): # pragma: no cover
25
+ if not isinstance (path , six .text_type ):
26
26
path = path .decode (sys .getfilesystemencoding ())
27
27
return path
28
28
Original file line number Diff line number Diff line change 12
12
13
13
def to_bytes (proto , string ):
14
14
# the address is a base58-encoded string
15
- if six .PY2 and isinstance (string , unicode ):
15
+ if six .PY2 and isinstance (string , unicode ): # pragma: no cover (PY2)
16
16
string = string .encode ("ascii" )
17
17
mm = base58 .b58decode (string )
18
18
if len (mm ) < 5 :
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ def __init__(self, addr):
39
39
# On Python 2 text string will often be binary anyways so detect the
40
40
# obvious case of a “binary-encoded” multiaddr starting with a slash
41
41
# and decode it into text
42
- if six .PY2 and isinstance (addr , str ) and addr .startswith ("/" ):
42
+ if six .PY2 and isinstance (addr , str ) and addr .startswith ("/" ): # pragma: no cover (PY2)
43
43
addr = addr .decode ("utf-8" )
44
44
45
45
if isinstance (addr , six .text_type ):
@@ -66,7 +66,7 @@ def __str__(self):
66
66
# On Python 2 __str__ needs to return binary text, so expose the original
67
67
# function as __unicode__ and transparently encode its returned text based
68
68
# on the current locale
69
- if six .PY2 :
69
+ if six .PY2 : # pragma: no cover (PY2)
70
70
__unicode__ = __str__
71
71
72
72
def __str__ (self ):
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ def _uvarint(buf):
123
123
for i , b_str in enumerate (buf ):
124
124
if six .PY3 :
125
125
b = b_str
126
- else :
126
+ else : # pragma: no cover (PY2)
127
127
b = int (binascii .b2a_hex (b_str ), 16 )
128
128
if b < 0x80 :
129
129
if i > 9 or (i == 9 and b > 1 ):
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ def string_iter(string):
78
78
value = "/" + "/" .join (sp )
79
79
if not six .PY2 :
80
80
sp .clear ()
81
- else :
81
+ else : # pragma: no cover (PY2)
82
82
sp = []
83
83
else :
84
84
value = sp .pop (0 )
You can’t perform that action at this time.
0 commit comments