Change to Python3 coding style

This commit is contained in:
shortcutme 2019-03-15 21:06:59 +01:00
parent fc0fe0557b
commit b0b9a4d33c
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
137 changed files with 910 additions and 913 deletions

View file

@ -3,7 +3,7 @@ import time
from util import helper
from Plugin import PluginManager
from BootstrapperDb import BootstrapperDb
from .BootstrapperDb import BootstrapperDb
from Crypt import CryptRsa
from Config import config
@ -70,7 +70,7 @@ class FileRequestPlugin(object):
hashes_changed = 0
db.execute("BEGIN")
for onion, onion_hashes in onion_to_hash.iteritems():
for onion, onion_hashes in onion_to_hash.items():
hashes_changed += db.peerAnnounce(
ip_type="onion",
address=onion,
@ -113,7 +113,7 @@ class FileRequestPlugin(object):
hash_peers = db.peerList(
hash,
address=self.connection.ip, onions=onion_to_hash.keys(), port=params["port"],
address=self.connection.ip, onions=list(onion_to_hash.keys()), port=params["port"],
limit=min(limit, params["need_num"]), need_types=params["need_types"], order=order
)
if "ip4" in params["need_types"]: # Backward compatibility

View file

@ -78,7 +78,7 @@ class TestBootstrapper:
assert len(res["peers"][0][ip_type]) == 1
# Test DB cleanup
assert map(lambda row: row[0], bootstrapper_db.execute("SELECT address FROM peer").fetchall()) == [file_server.ip_external] # 127.0.0.1 never get added to db
assert [row[0] for row in bootstrapper_db.execute("SELECT address FROM peer").fetchall()] == [file_server.ip_external] # 127.0.0.1 never get added to db
# Delete peers
bootstrapper_db.execute("DELETE FROM peer WHERE address = ?", [file_server.ip_external])

View file

@ -1 +1 @@
import BootstrapperPlugin
from . import BootstrapperPlugin