From 75c9d10adc11356f112a00e1fff2eb5b8f68ce82 Mon Sep 17 00:00:00 2001 From: Benedikt Moneke <67148916+bmoneke@users.noreply.github.com> Date: Thu, 13 Jul 2023 12:04:17 +0200 Subject: [PATCH] Revert introduced errors in message and test_message and fix more mypy issues. --- docs/conf.py | 1 + pyleco/__init__.py | 2 +- pyleco/core/message.py | 4 ++-- pyleco/core/rpc_generator.py | 4 ++-- pyleco/core/serialization.py | 2 +- tests/core/test_message.py | 4 ++-- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index b1978cc2..840235b3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,3 +1,4 @@ +# mypy: ignore-errors # # PyLeco documentation build configuration file, created by # sphinx-quickstart on Mon Apr 6 13:06:00 2015. diff --git a/pyleco/__init__.py b/pyleco/__init__.py index 1c806830..e0ff630b 100644 --- a/pyleco/__init__.py +++ b/pyleco/__init__.py @@ -32,7 +32,7 @@ # If a user has setuptools_scm installed, assume they want the most up to date version string. # Alternatively, we could use a dummy dev module that is never packaged whose presence signals # that we are in an editable install/repo, see https://github.com/pycalphad/pycalphad/pull/341 - import setuptools_scm + import setuptools_scm # type: ignore __version__ = setuptools_scm.get_version(root='..', relative_to=__file__) del setuptools_scm except (ImportError, LookupError): diff --git a/pyleco/core/message.py b/pyleco/core/message.py index 92aa7e33..ecda04be 100644 --- a/pyleco/core/message.py +++ b/pyleco/core/message.py @@ -44,13 +44,13 @@ class Message: - 0 or more `payload` frames If you do not specify a sender, the sending program shall add it itself. - The :attr:`data` attribute is the content of the first :attr:`payload` frame. It can be set with asfd asd + The :attr:`data` attribute is the content of the first :attr:`payload` frame. It can be set with the corresponding argument. All attributes, except the official frames, are for convenience. """ version: bytes = VERSION_B - receiver: str + receiver: bytes sender: bytes header: bytes payload: list[bytes] diff --git a/pyleco/core/rpc_generator.py b/pyleco/core/rpc_generator.py index d18320ef..98408fba 100644 --- a/pyleco/core/rpc_generator.py +++ b/pyleco/core/rpc_generator.py @@ -24,7 +24,7 @@ from typing import Any -from jsonrpc2pyclient._irpcclient import IRPCClient +from jsonrpc2pyclient._irpcclient import IRPCClient # type: ignore class RPCGenerator(IRPCClient): @@ -45,4 +45,4 @@ def get_result_from_response(self, data: bytes | str) -> Any: def clear_id_list(self) -> None: """Reset the list of created ids.""" - self._ids = {} + self._ids: dict[int, int] = {} diff --git a/pyleco/core/serialization.py b/pyleco/core/serialization.py index f02bd9dc..075afa2a 100644 --- a/pyleco/core/serialization.py +++ b/pyleco/core/serialization.py @@ -25,7 +25,7 @@ import json from typing import Optional, NamedTuple -from uuid_extensions import uuid7 # as long as uuid does not yet support UUIDv7 +from uuid_extensions import uuid7 # type: ignore # as long as uuid does not yet support UUIDv7 from jsonrpcobjects.objects import (RequestObject, RequestObjectParams, ResultResponseObject, ErrorResponseObject, diff --git a/tests/core/test_message.py b/tests/core/test_message.py index 6f159f7d..6b276b7c 100644 --- a/tests/core/test_message.py +++ b/tests/core/test_message.py @@ -28,7 +28,7 @@ from pyleco.core.message import Message -# asdf asdf asfd + cid = b"conversation_id;" @@ -85,7 +85,7 @@ def test_message_data_str_to_binary_data(self): class Test_Message_from_frames: - def test_message_from_frames(self, message: str): + def test_message_from_frames(self, message: Message): message.version = b"diff" # also if the version is different assert Message.from_frames(*message.to_frames()) == message