Format network.tcp for flake8

This commit is contained in:
Dmitri Bogomolov 2020-06-09 22:37:02 +03:00
parent 54e44eac95
commit 1035d2aec4
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -80,8 +80,8 @@ class TCPConnection(BMProto, TLSDispatcher):
try:
self.local = (
protocol.checkIPAddress(
protocol.encodeHost(self.destination.host), True) and
not protocol.checkSocksIP(self.destination.host)
protocol.encodeHost(self.destination.host), True)
and not protocol.checkSocksIP(self.destination.host)
)
except socket.error:
# it's probably a hostname
@ -175,9 +175,9 @@ class TCPConnection(BMProto, TLSDispatcher):
# and having positive or neutral rating
filtered = [
(k, v) for k, v in nodes.iteritems()
if v["lastseen"] > int(time.time()) -
maximumAgeOfNodesThatIAdvertiseToOthers and
v["rating"] >= 0 and len(k.host) <= 22
if v["lastseen"] > int(time.time())
- maximumAgeOfNodesThatIAdvertiseToOthers
and v["rating"] >= 0 and len(k.host) <= 22
]
# sent 250 only if the remote isn't interested in it
elemCount = min(
@ -408,11 +408,11 @@ class TCPServer(AdvancedDispatcher):
state.ownAddresses[Peer(*sock.getsockname())] = True
if (
len(connectionpool.BMConnectionPool().inboundConnections) +
len(connectionpool.BMConnectionPool().outboundConnections) >
BMConfigParser().safeGetInt(
'bitmessagesettings', 'maxtotalconnections') +
BMConfigParser().safeGetInt(
len(connectionpool.BMConnectionPool().inboundConnections)
+ len(connectionpool.BMConnectionPool().outboundConnections)
> BMConfigParser().safeGetInt(
'bitmessagesettings', 'maxtotalconnections')
+ BMConfigParser().safeGetInt(
'bitmessagesettings', 'maxbootstrapconnections') + 10
):
# 10 is a sort of buffer, in between it will go through