Skip to content

Commit bf225b2

Browse files
committed
Fix various formatting issues
1 parent 62ebccc commit bf225b2

11 files changed

Lines changed: 268 additions & 266 deletions

bitcoin/base58.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,21 @@ def encode(b):
4747
# Divide that integer into bas58
4848
res = []
4949
while n > 0:
50-
n, r = divmod (n, 58)
50+
n, r = divmod(n, 58)
5151
res.append(b58_digits[r])
5252
res = ''.join(res[::-1])
5353

5454
# Encode leading zeros as base58 zeros
55-
import sys
5655
czero = b'\x00'
5756
if sys.version > '3':
5857
# In Python3 indexing a bytes returns numbers, not characters.
5958
czero = 0
6059
pad = 0
6160
for c in b:
62-
if c == czero: pad += 1
63-
else: break
61+
if c == czero:
62+
pad += 1
63+
else:
64+
break
6465
return b58_digits[0] * pad + res
6566

6667
def decode(s):

bitcoin/core/bignum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ def bn_bytes(v, have_ext=False):
2222
ext = 0
2323
if have_ext:
2424
ext = 1
25-
return ((v.bit_length()+7)//8) + ext
25+
return ((v.bit_length() + 7) // 8) + ext
2626

2727
def bn2bin(v):
2828
s = bytearray()
2929
i = bn_bytes(v)
3030
while i > 0:
31-
s.append((v >> ((i-1) * 8)) & 0xff)
31+
s.append((v >> ((i - 1) * 8)) & 0xff)
3232
i -= 1
3333
return s
3434

bitcoin/core/key.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import hashlib
2222
import sys
2323

24-
ssl = ctypes.cdll.LoadLibrary(ctypes.util.find_library ('ssl') or 'libeay32')
24+
ssl = ctypes.cdll.LoadLibrary(ctypes.util.find_library('ssl') or 'libeay32')
2525

2626
# this specifies the curve used with ECDSA.
2727
NID_secp256k1 = 714 # from openssl/obj_mac.h
@@ -31,7 +31,7 @@ def _check_result (val, func, args):
3131
if val == 0:
3232
raise ValueError
3333
else:
34-
return ctypes.c_void_p (val)
34+
return ctypes.c_void_p(val)
3535

3636
ssl.EC_KEY_new_by_curve_name.restype = ctypes.c_void_p
3737
ssl.EC_KEY_new_by_curve_name.errcheck = _check_result

0 commit comments

Comments
 (0)