mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-07 13:18:43 +02:00
test: remove type: comments in favour of actual annotations
Now that we require Python 3.6+, we should be using variable type annotations directly rather than # type: comments. Also takes care of the discarded value issue in p2p_message_capture.py. See: https://github.com/bitcoin/bitcoin/pull/19509/files#r571674446.
This commit is contained in:
@@ -42,14 +42,14 @@ def mini_parser(dat_file):
|
||||
if not tmp_header_raw:
|
||||
break
|
||||
tmp_header = BytesIO(tmp_header_raw)
|
||||
int.from_bytes(tmp_header.read(TIME_SIZE), "little") # type: int
|
||||
tmp_header.read(TIME_SIZE) # skip the timestamp field
|
||||
raw_msgtype = tmp_header.read(MSGTYPE_SIZE)
|
||||
msgtype = raw_msgtype.split(b'\x00', 1)[0] # type: bytes
|
||||
msgtype: bytes = raw_msgtype.split(b'\x00', 1)[0]
|
||||
remainder = raw_msgtype.split(b'\x00', 1)[1]
|
||||
assert(len(msgtype) > 0)
|
||||
assert(msgtype in MESSAGEMAP)
|
||||
assert(len(remainder) == 0 or not remainder.decode().isprintable())
|
||||
length = int.from_bytes(tmp_header.read(LENGTH_SIZE), "little") # type: int
|
||||
length: int = int.from_bytes(tmp_header.read(LENGTH_SIZE), "little")
|
||||
data = f_in.read(length)
|
||||
assert_equal(len(data), length)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user