Lint fixes:

- split the last long line in the connection module
  - resolved pylint useless-object-inheritance and unused-variable
This commit is contained in:
Dmitri Bogomolov 2021-08-01 17:55:08 +03:00
parent 4b0424807e
commit ba4bbd4129
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
3 changed files with 14 additions and 13 deletions

View File

@ -260,7 +260,8 @@ class Connection(threading.Thread):
while len(to_send) > 0:
if len(to_send) > 10000:
# We limit size of inv messaged to 10000 entries
# because they might time out in very slow networks (I2P)
# because they might time out
# in very slow networks (I2P)
pack = random.sample(to_send, 10000)
self.send_queue.put(message.Inv(pack))
to_send.difference_update(pack)

View File

@ -7,7 +7,7 @@ import time
from . import shared, structure
class Header(object):
class Header():
def __init__(self, command, payload_length, payload_checksum):
self.command = command
self.payload_length = payload_length
@ -42,7 +42,7 @@ class Header(object):
return cls(command, payload_length, payload_checksum)
class Message(object):
class Message():
def __init__(self, command, payload):
self.command = command
self.payload = payload
@ -84,7 +84,7 @@ class Message(object):
return cls(h.command, payload)
class Version(object):
class Version():
def __init__(
self, host, port, protocol_version=shared.protocol_version,
services=shared.services, nonce=shared.nonce,
@ -127,8 +127,8 @@ class Version(object):
payload = m.payload
( # unused: net_addr_local
protocol_version, services, t, net_addr_remote, _, nonce
( # unused: timestamp, net_addr_local
protocol_version, services, _, net_addr_remote, _, nonce
) = struct.unpack('>IQQ26s26s8s', payload[:80])
net_addr_remote = structure.NetAddrNoPrefix.from_bytes(net_addr_remote)
@ -154,7 +154,7 @@ class Version(object):
return cls(host, port, protocol_version, services, nonce, user_agent)
class Inv(object):
class Inv():
def __init__(self, vectors):
self.vectors = set(vectors)
@ -189,7 +189,7 @@ class Inv(object):
return cls(vectors)
class GetData(object):
class GetData():
def __init__(self, vectors):
self.vectors = set(vectors)
@ -224,7 +224,7 @@ class GetData(object):
return cls(vectors)
class Addr(object):
class Addr():
def __init__(self, addresses):
self.addresses = addresses

View File

@ -9,7 +9,7 @@ import time
from . import shared
class VarInt(object):
class VarInt():
def __init__(self, n):
self.n = n
@ -43,7 +43,7 @@ class VarInt(object):
return cls(n)
class Object(object):
class Object():
def __init__(
self, nonce, expires_time, object_type, version,
stream_number, object_payload
@ -138,7 +138,7 @@ class Object(object):
return hashlib.sha512(self.to_bytes()[8:]).digest()
class NetAddrNoPrefix(object):
class NetAddrNoPrefix():
def __init__(self, services, host, port):
self.services = services
self.host = host
@ -170,7 +170,7 @@ class NetAddrNoPrefix(object):
return cls(services, host, port)
class NetAddr(object):
class NetAddr():
def __init__(self, services, host, port, stream=shared.stream):
self.stream = stream
self.services = services