From 57bcd7ca897dc34af82fefb4c7b2122ecf67d899 Mon Sep 17 00:00:00 2001 From: vtexier <vit@free.fr> Date: Wed, 29 May 2019 19:12:50 +0200 Subject: [PATCH] [enh] #91 fix code to comply with mypy and pylint Remove one pylint alert --- Makefile | 2 +- duniterpy/api/client.py | 14 ++++++++------ duniterpy/documents/transaction.py | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 417a348a..f8035f87 100644 --- a/Makefile +++ b/Makefile @@ -17,4 +17,4 @@ mypy: # check code errors pylint: - pylint --disable=C,R0913,R0903,R0902,R0914,R0912,R0915 --enable=C0121,C0202,C0321 --jobs=0 duniterpy/ + pylint --disable=C,R0913,R0903,R0902,R0914,R0912,R0915,W0613 --enable=C0121,C0202,C0321 --jobs=0 duniterpy/ diff --git a/duniterpy/api/client.py b/duniterpy/api/client.py index d16c0d1d..a1f102a0 100644 --- a/duniterpy/api/client.py +++ b/duniterpy/api/client.py @@ -236,12 +236,13 @@ class Client: await parse_response(response, schema) # return the chosen type + result = response # type: Any if rtype == RESPONSE_TEXT: - response = await response.text() + result = await response.text() elif rtype == RESPONSE_JSON: - response = await response.json() + result = await response.json() - return response + return result async def post(self, url_path: str, params: dict = None, rtype: str = RESPONSE_JSON, schema: dict = None) -> Any: """ @@ -267,12 +268,13 @@ class Client: await parse_response(response, schema) # return the chosen type + result = response # type: Any if rtype == RESPONSE_TEXT: - response = await response.text() + result = await response.text() elif rtype == RESPONSE_JSON: - response = await response.json() + result = await response.json() - return response + return result def connect_ws(self, path: str) -> _WSRequestContextManager: """ diff --git a/duniterpy/documents/transaction.py b/duniterpy/documents/transaction.py index 5ee29404..bdd5075c 100644 --- a/duniterpy/documents/transaction.py +++ b/duniterpy/documents/transaction.py @@ -339,7 +339,7 @@ class UnlockParameter: :param parameter: Parameter string :return: """ - result = None + result = None # type: Optional[Union[SIGParameter, XHXParameter]] sig_param = SIGParameter.from_parameter(parameter) if sig_param: result = sig_param -- GitLab