From f86a3014338de6a2204bbdda10795b75ef6654c0 Mon Sep 17 00:00:00 2001 From: Jon Atack Date: Thu, 29 Jun 2023 15:41:27 -0600 Subject: [PATCH] script, test: add missing python type annotations Fix warnings for these files when ./test/lint/lint-python.py is run using mypy 0.991 (released 11/2022) and later: "By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]" For details, see: https://mypy-lang.blogspot.com/2022/11/mypy-0990-released.html --- contrib/devtools/test-security-check.py | 2 +- test/functional/p2p_message_capture.py | 2 +- test/functional/test_framework/test_framework.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/devtools/test-security-check.py b/contrib/devtools/test-security-check.py index 90268740c60..1390e310f28 100755 --- a/contrib/devtools/test-security-check.py +++ b/contrib/devtools/test-security-check.py @@ -28,7 +28,7 @@ def clean_files(source, executable): os.remove(source) os.remove(executable) -def call_security_check(cc, source, executable, options): +def call_security_check(cc: str, source: str, executable: str, options) -> tuple: # This should behave the same as AC_TRY_LINK, so arrange well-known flags # in the same order as autoconf would. # diff --git a/test/functional/p2p_message_capture.py b/test/functional/p2p_message_capture.py index 62ff4da8fd1..691a0b6409c 100755 --- a/test/functional/p2p_message_capture.py +++ b/test/functional/p2p_message_capture.py @@ -19,7 +19,7 @@ TIME_SIZE = 8 LENGTH_SIZE = 4 MSGTYPE_SIZE = 12 -def mini_parser(dat_file): +def mini_parser(dat_file: str) -> None: """Parse a data file created by CaptureMessageToFile. From the data file we'll only check the structure. diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index d3aae3fb9a2..73e7516ea7e 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -92,7 +92,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): This class also contains various public and private helper methods.""" - def __init__(self): + def __init__(self) -> None: """Sets test framework defaults. Do not override this method. Instead, override the set_test_params() method""" self.chain: str = 'regtest' self.setup_clean_chain: bool = False