mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
Merge bitcoin/bitcoin#28009: script, test: python typing and linter updates
6c97757a48script: appease spelling linter (Jon Atack)1316119ce7script: update ignored-words.txt (Jon Atack)146c861da2script: update linter dependencies (Jon Atack)92408224a4test: fix PEP484 no implicit optional argument types errors (Jon Atack)f86a301433script, test: add missing python type annotations (Jon Atack) Pull request description: With these updates, `./test/lint/lint-python.py` and `./test/lint/lint-spelling.py` should be green again for developers using relatively recent Python dependencies, in particular mypy 0.991 (released 11/2022) and later. Please see the commit messages for details. ACKs for top commit: fanquake: ACK6c97757a48Tree-SHA512: 8a46a4d36d5978affdcecf4f2ace20ca1b52d483e098304911a2169afe60ccb9b042fa90c04b762d94f3ce53d2cafe6f24476ae839867a770c7f31e7e7242d99
This commit is contained in:
@@ -26,6 +26,7 @@ from test_framework.wallet import (
|
||||
MiniWallet,
|
||||
getnewdestination,
|
||||
)
|
||||
from typing import Optional
|
||||
|
||||
|
||||
INVALID_PARAM = "abc"
|
||||
@@ -64,7 +65,7 @@ class RESTTest (BitcoinTestFramework):
|
||||
body: str = '',
|
||||
status: int = 200,
|
||||
ret_type: RetType = RetType.JSON,
|
||||
query_params: typing.Dict[str, typing.Any] = None,
|
||||
query_params: Optional[typing.Dict[str, typing.Any]] = None,
|
||||
) -> typing.Union[http.client.HTTPResponse, bytes, str, None]:
|
||||
rest_uri = '/rest' + uri
|
||||
if req_type in ReqType:
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -11,6 +11,7 @@ testing.
|
||||
import os
|
||||
|
||||
from .authproxy import AuthServiceProxy
|
||||
from typing import Optional
|
||||
|
||||
REFERENCE_FILENAME = 'rpc_interface.txt'
|
||||
|
||||
@@ -20,7 +21,7 @@ class AuthServiceProxyWrapper():
|
||||
An object that wraps AuthServiceProxy to record specific RPC calls.
|
||||
|
||||
"""
|
||||
def __init__(self, auth_service_proxy_instance: AuthServiceProxy, rpc_url: str, coverage_logfile: str=None):
|
||||
def __init__(self, auth_service_proxy_instance: AuthServiceProxy, rpc_url: str, coverage_logfile: Optional[str]=None):
|
||||
"""
|
||||
Kwargs:
|
||||
auth_service_proxy_instance: the instance being wrapped.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -309,7 +309,7 @@ class PortSeed:
|
||||
n = None
|
||||
|
||||
|
||||
def get_rpc_proxy(url: str, node_number: int, *, timeout: int=None, coveragedir: str=None) -> coverage.AuthServiceProxyWrapper:
|
||||
def get_rpc_proxy(url: str, node_number: int, *, timeout: Optional[int]=None, coveragedir: Optional[str]=None) -> coverage.AuthServiceProxyWrapper:
|
||||
"""
|
||||
Args:
|
||||
url: URL of the RPC server to call
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
afile
|
||||
asend
|
||||
ba
|
||||
blockin
|
||||
@@ -15,6 +16,7 @@ lief
|
||||
mor
|
||||
nd
|
||||
nin
|
||||
requestor
|
||||
ser
|
||||
siz
|
||||
stap
|
||||
|
||||
Reference in New Issue
Block a user