From 5328f733960f874d1bc10fe1bdb073f9b8e82685 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Thu, 6 Jun 2019 22:41:13 -0400 Subject: [PATCH] Resolve PEP8 in IoTDM Change-Id: I8c70d250db546ec7e0a2febf194189693fb1e450 Signed-off-by: Thanh Ha --- csit/libraries/IoTDM/client_libs/onem2m_http.py | 4 ++-- csit/libraries/IoTDM/client_libs/onem2m_json_primitive.py | 4 ++-- .../IoTDM/client_libs/testing/test_onem2m_http.py | 3 +-- csit/libraries/IoTDM/iotdm.py | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/csit/libraries/IoTDM/client_libs/onem2m_http.py b/csit/libraries/IoTDM/client_libs/onem2m_http.py index d64ace2409..9f3f94abe3 100644 --- a/csit/libraries/IoTDM/client_libs/onem2m_http.py +++ b/csit/libraries/IoTDM/client_libs/onem2m_http.py @@ -164,7 +164,7 @@ class OneM2MHttpTx(IoTTx): def send(self, jsonprimitive): try: message = self.encoder.encode(jsonprimitive) - except IoTDataEncodeError as e: + except IoTDataEncodeError: return None rsp_message = self.session.send(message) @@ -172,7 +172,7 @@ class OneM2MHttpTx(IoTTx): rsp_primitive = None try: rsp_primitive = self.decoder.decode(rsp_message) - except IoTDataDecodeError as e: + except IoTDataDecodeError: return None return rsp_primitive diff --git a/csit/libraries/IoTDM/client_libs/onem2m_json_primitive.py b/csit/libraries/IoTDM/client_libs/onem2m_json_primitive.py index a0afa3accb..0bc9cbb27f 100644 --- a/csit/libraries/IoTDM/client_libs/onem2m_json_primitive.py +++ b/csit/libraries/IoTDM/client_libs/onem2m_json_primitive.py @@ -88,8 +88,8 @@ class OneM2MJsonPrimitive(OneM2MPrimitive): json_pointer = pointer try: - item = json_pointer.resolve(data_dict) - except JsonPointerException as e: + json_pointer.resolve(data_dict) + except JsonPointerException: return False return True diff --git a/csit/libraries/IoTDM/client_libs/testing/test_onem2m_http.py b/csit/libraries/IoTDM/client_libs/testing/test_onem2m_http.py index 0c2004b486..364fa45255 100644 --- a/csit/libraries/IoTDM/client_libs/testing/test_onem2m_http.py +++ b/csit/libraries/IoTDM/client_libs/testing/test_onem2m_http.py @@ -77,8 +77,7 @@ class TestOneM2MHttp(unittest.TestCase): builder.set_content(content) primitive = builder.build() - rsp_primitive = tx.send(primitive) - # TODO rsp_primitive should be the same primitive, just use _compare() + tx.send(primitive) # TODO method of primitive if was correctly encoded / decoded tx.stop() diff --git a/csit/libraries/IoTDM/iotdm.py b/csit/libraries/IoTDM/iotdm.py index 923f227aeb..43139b6f96 100644 --- a/csit/libraries/IoTDM/iotdm.py +++ b/csit/libraries/IoTDM/iotdm.py @@ -93,7 +93,7 @@ def find_key(response, key): try: val = response.json() return val['any'][0][key] - except: + except Exception: return None @@ -126,7 +126,7 @@ def status(response): """Return the protocol status code in the response.""" try: return response.status_code - except: + except Exception: return None @@ -134,7 +134,7 @@ def headers(response): """Return the protocol headers in the response.""" try: return response.headers - except: + except Exception: return None @@ -142,7 +142,7 @@ def error(response): """Return the error string in the response.""" try: return response.json()['error'] - except: + except Exception: return None -- 2.36.6