Minor Python cleanups to make flake8 pass with the new rules enabled
This commit is contained in:
1 parent
0d6992168c
commit
f020aca297
21 files changed
+58
-50
No files matched your search
@@ -34,7 +34,8 @@ These should be pasted into `src/chainparamsseeds.h`.
|
||||
|
||||
from base64 import b32decode
|
||||
from binascii import a2b_hex
|
||||
import sys, os
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
# ipv4 in ipv6 prefix
|
||||
@@ -46,7 +47,7 @@ def name_to_ipv6(addr):
|
||||
if len(addr)>6 and addr.endswith('.onion'):
|
||||
vchAddr = b32decode(addr[0:-6], True)
|
||||
if len(vchAddr) != 16-len(pchOnionCat):
|
||||
raise ValueError('Invalid onion %s' % s)
|
||||
raise ValueError('Invalid onion %s' % vchAddr)
|
||||
return pchOnionCat + vchAddr
|
||||
elif '.' in addr: # IPv4
|
||||
return pchIPv4 + bytearray((int(x) for x in addr.split('.')))
|
||||
@@ -132,7 +133,7 @@ def main():
|
||||
with open(os.path.join(indir,'nodes_test.txt'),'r') as f:
|
||||
process_nodes(g, f, 'pnSeed6_test', 18333)
|
||||
g.write('#endif // BITCOIN_CHAINPARAMSSEEDS_H\n')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
# Generate seeds.txt from Pieter's DNS seeder
|
||||
#
|
||||
|
||||
import re
|
||||
import sys
|
||||
import dns.resolver
|
||||
import collections
|
||||
|
||||
NSEEDS=512
|
||||
|
||||
MAX_SEEDS_PER_ASN=2
|
||||
@@ -22,11 +27,6 @@ SUSPICIOUS_HOSTS = {
|
||||
"54.94.195.96", "54.94.200.247"
|
||||
}
|
||||
|
||||
import re
|
||||
import sys
|
||||
import dns.resolver
|
||||
import collections
|
||||
|
||||
PATTERN_IPV4 = re.compile(r"^((\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})):(\d+)$")
|
||||
PATTERN_IPV6 = re.compile(r"^\[([0-9a-z:]+)\]:(\d+)$")
|
||||
PATTERN_ONION = re.compile(r"^([abcdefghijklmnopqrstuvwxyz234567]{16}\.onion):(\d+)$")
|
||||
|
||||
Reference in new issue
Block a user