build(deps-dev): bump mypy from 1.5.1 to 1.7.0 (#16788)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
This commit is contained in:
dependabot[bot] 2023-11-14 12:20:56 -06:00 committed by GitHub
parent de0328bdfb
commit e986d1e3ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 29 deletions

View File

@ -1036,7 +1036,13 @@ class DataLayer:
coros = [get_plugin_info(plugin_remote=plugin) for plugin in {*self.uploaders, *self.downloaders}]
results = dict(await asyncio.gather(*coros))
uploader_status = {uploader.url: results.get(uploader.url, "unknown") for uploader in self.uploaders}
downloader_status = {downloader.url: results.get(downloader.url, "unknown") for downloader in self.downloaders}
unknown = {
"name": "unknown",
"version": "unknown",
"instance": "unknown",
}
uploader_status = {uploader.url: results.get(uploader, unknown) for uploader in self.uploaders}
downloader_status = {downloader.url: results.get(downloader, unknown) for downloader in self.downloaders}
return PluginStatus(uploaders=uploader_status, downloaders=downloader_status)

View File

@ -2,7 +2,7 @@ from __future__ import annotations
import dataclasses
import operator
from typing import Any, Callable, Dict, List, Optional
from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple
from typing_extensions import Protocol
@ -18,19 +18,13 @@ from chia.util.streamable import Streamable, streamable
from chia.util.ws_message import WsRpcMessage, create_payload_dict
@dataclasses.dataclass
@dataclasses.dataclass(frozen=True)
class PaginatedRequestData(Protocol):
@property
def node_id(self) -> bytes32:
pass
node_id: bytes32
page: uint32
page_size: uint32
@property
def page(self) -> uint32:
pass
@property
def page_size(self) -> uint32:
pass
__match_args__: ClassVar[Tuple[str, ...]] = ()
@streamable
@ -50,6 +44,8 @@ class PlotInfoRequestData(Streamable):
sort_key: str = "filename"
reverse: bool = False
__match_args__: ClassVar[Tuple[str, ...]] = ()
@streamable
@dataclasses.dataclass(frozen=True)
@ -60,6 +56,8 @@ class PlotPathRequestData(Streamable):
filter: List[str] = dataclasses.field(default_factory=list)
reverse: bool = False
__match_args__: ClassVar[Tuple[str, ...]] = ()
def paginated_plot_request(source: List[Any], request: PaginatedRequestData) -> Dict[str, object]:
paginator: Paginator = Paginator(source, request.page_size)

View File

@ -525,14 +525,14 @@ class Keychain:
"""
Returns whether a user-supplied passphrase is optional, as specified by the passphrase requirements.
"""
return passphrase_requirements().get("is_optional", False)
return passphrase_requirements().get("is_optional", False) # type: ignore[no-any-return]
@staticmethod
def minimum_passphrase_length() -> int:
"""
Returns the minimum passphrase length, as specified by the passphrase requirements.
"""
return passphrase_requirements().get("min_length", 0)
return passphrase_requirements().get("min_length", 0) # type: ignore[no-any-return]
@staticmethod
def passphrase_meets_requirements(passphrase: Optional[str]) -> bool:

View File

@ -16,7 +16,6 @@ warn_return_any = True
no_implicit_reexport = True
strict_equality = True
warn_redundant_casts = True
enable_incomplete_feature = Unpack
[mypy-chia-exclusions]
disable_error_code = annotation-unchecked

View File

@ -57,7 +57,7 @@ dev_dependencies = [
"twine==4.0.2",
"isort==5.12.0",
"flake8==6.1.0",
"mypy==1.5.1",
"mypy==1.7.0",
"black==23.10.1",
"lxml==4.9.3",
"aiohttp_cors==0.7.0", # For blackd

View File

@ -417,7 +417,7 @@ def create_service_and_wallet_client_generators(test_rpc_clients: TestRpcClients
# For more information, read the docstring of this function.
chia.cmds.cmds_util.get_any_service_client = test_get_any_service_client
chia.cmds.cmds_util.get_wallet_client = test_get_wallet_client # type: ignore[assignment]
chia.cmds.wallet_funcs.get_wallet_client = test_get_wallet_client # type: ignore[attr-defined]
chia.cmds.wallet_funcs.get_wallet_client = test_get_wallet_client # type: ignore[assignment,attr-defined]
# Monkey patches the confirm function to not ask for confirmation
chia.cmds.cmds_util.cli_confirm = cli_confirm
chia.cmds.wallet_funcs.cli_confirm = cli_confirm # type: ignore[attr-defined]

View File

@ -440,18 +440,10 @@ async def test_farmer_get_harvester_plots_endpoints(
await wait_for_plot_sync(receiver, last_sync_id)
for page_size in [1, int(total_count / 2), total_count - 1, total_count, total_count + 1, 100]:
# TODO: figure out hinting of PaginatedRequestData that satisfies this with frozen attributes
request = dataclasses.replace(
request,
page_size=uint32(page_size), # type: ignore[call-arg]
)
request = dataclasses.replace(request, page_size=uint32(page_size))
expected_page_count = ceil(total_count / page_size)
for page in range(expected_page_count):
# TODO: figure out hinting of PaginatedRequestData that satisfies this with frozen attributes
request = dataclasses.replace(
request,
page=uint32(page), # type: ignore[call-arg]
)
request = dataclasses.replace(request, page=uint32(page))
await wait_for_synced_receiver(farmer_service._api.farmer, harvester_id)
page_result = await endpoint(farmer_rpc_client, request)
offset = page * page_size