From c5bb3b57af06bce17edc066bf7e63e86a4263355 Mon Sep 17 00:00:00 2001 From: vtexier <vit@free.fr> Date: Sat, 21 Dec 2019 22:57:13 +0100 Subject: [PATCH] [fix] #59 fix pylint warnings --- Makefile | 6 +++--- duniterpy/api/client.py | 17 +++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index ac230122..b47f12f8 100644 --- a/Makefile +++ b/Makefile @@ -20,9 +20,9 @@ mypy: # check code errors pylint: - pylint --disable=C,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W0613 --enable=C0121,C0202,C0321 --jobs=0 duniterpy/ - pylint --disable=C,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W0613 --enable=C0121,C0202,C0321 --jobs=0 tests/ - pylint --disable=C,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W0613 --enable=C0121,C0202,C0321 --jobs=0 examples/ + pylint --disable=C,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W1202,W0613 --enable=C0121,C0202,C0321 --jobs=0 duniterpy/ + pylint --disable=C,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W1202,W0613 --enable=C0121,C0202,C0321 --jobs=0 tests/ + pylint --disable=C,R0902,R0903,R0904,R0912,R0913,R0914,R0915,W1202,W0613 --enable=C0121,C0202,C0321 --jobs=0 examples/ # check format check-format: diff --git a/duniterpy/api/client.py b/duniterpy/api/client.py index 74bf6c76..99e1e44e 100644 --- a/duniterpy/api/client.py +++ b/duniterpy/api/client.py @@ -192,13 +192,13 @@ class API: url = self.reverse_url(self.connection_handler.http_scheme, path) if data is not None: - logging.debug("{0} : {1}, data={2}".format(method, url, data)) + logging.debug(f"{method} : {url}, data={data}") elif _json is not None: - logging.debug("{0} : {1}, json={2}".format(method, url, _json)) + logging.debug(f"{method} : {url}, json={_json}") # http header to send json body self.headers['Content-Type'] = 'application/json; charset=utf-8' else: - logging.debug("{0} : {1}".format(method, url)) + logging.debug(f"{method} : {url}") response = await self.connection_handler.session.request( method, @@ -320,12 +320,13 @@ class Client: await parse_response(response, schema) # return the chosen type - if rtype == RESPONSE_AIOHTTP: - return response - elif rtype == RESPONSE_TEXT: - return await response.text() + result = response # type: Any + if rtype == RESPONSE_TEXT: + result = await response.text() elif rtype == RESPONSE_JSON: - return await response.json() + result = await response.json() + + return result async def query(self, query: str, variables: Optional[dict] = None, rtype: str = RESPONSE_JSON, schema: Optional[dict] = None) -> Any: -- GitLab