From ab022a65ed44e7b853350d769a26ec9bc7adc26b Mon Sep 17 00:00:00 2001 From: Zedifus Date: Mon, 23 May 2022 20:35:43 +0100 Subject: [PATCH 1/3] Version bumping jsonlint Checking if this is causing lint issue --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index d57a8b2f..d57479e9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,5 +17,5 @@ requests==2.26 termcolor==1.1 tornado==6.0 tzlocal==4.0 -jsonschema==4.4.0 +jsonschema==4.5.1 orjson==3.6.7 From 4205c0a8f06515bb9f691bc4e689da0eb370e590 Mon Sep 17 00:00:00 2001 From: Zedifus Date: Mon, 23 May 2022 20:53:23 +0100 Subject: [PATCH 2/3] Exempt jsonschema falsepositive E0611 Can't understand why these are flagging, code is as per docs. Version is latest, and not flagging locally. Going to exempt mod for now --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index ba047ba8..6e47cc92 100644 --- a/.pylintrc +++ b/.pylintrc @@ -443,7 +443,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis). It # supports qualified module names, as well as Unix pattern matching. -ignored-modules= +ignored-modules=jsonschema # Show a hint with possible names when a member name was not found. The aspect # of finding the hint is based on edit distance. From d0596af4c9b2eb38e16eb6f8f2d68c7cdce7965d Mon Sep 17 00:00:00 2001 From: Zedifus Date: Mon, 23 May 2022 22:54:06 +0100 Subject: [PATCH 3/3] Add exemption orjson no-member falsepositive --- .pylintrc | 2 +- app/classes/web/base_handler.py | 2 +- app/classes/web/routes/api/roles/index.py | 4 ++-- app/classes/web/routes/api/roles/role/index.py | 4 ++-- app/classes/web/routes/api/servers/index.py | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.pylintrc b/.pylintrc index 6e47cc92..a7573c8e 100644 --- a/.pylintrc +++ b/.pylintrc @@ -443,7 +443,7 @@ ignored-classes=optparse.Values,thread._local,_thread._local # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis). It # supports qualified module names, as well as Unix pattern matching. -ignored-modules=jsonschema +ignored-modules=jsonschema,orjson # Show a hint with possible names when a member name was not found. The aspect # of finding the hint is based on edit distance. diff --git a/app/classes/web/base_handler.py b/app/classes/web/base_handler.py index c7aca58c..8a649d78 100644 --- a/app/classes/web/base_handler.py +++ b/app/classes/web/base_handler.py @@ -238,4 +238,4 @@ class BaseHandler(tornado.web.RequestHandler): def finish_json(self, status: int, data: t.Dict[str, t.Any]): self.set_status(status) self.set_header("Content-Type", "application/json") - self.finish(orjson.dumps(data)) # pylint: disable=no-member + self.finish(orjson.dumps(data)) diff --git a/app/classes/web/routes/api/roles/index.py b/app/classes/web/routes/api/roles/index.py index d98d8d53..11142ebc 100644 --- a/app/classes/web/routes/api/roles/index.py +++ b/app/classes/web/routes/api/roles/index.py @@ -79,8 +79,8 @@ class ApiRolesIndexHandler(BaseApiHandler): return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"}) try: - data = orjson.loads(self.request.body) # pylint: disable=no-member - except orjson.decoder.JSONDecodeError as e: # pylint: disable=no-member + data = orjson.loads(self.request.body) + except orjson.decoder.JSONDecodeError as e: return self.finish_json( 400, {"status": "error", "error": "INVALID_JSON", "error_data": str(e)} ) diff --git a/app/classes/web/routes/api/roles/role/index.py b/app/classes/web/routes/api/roles/role/index.py index 8dbb7373..43abbd55 100644 --- a/app/classes/web/routes/api/roles/role/index.py +++ b/app/classes/web/routes/api/roles/role/index.py @@ -105,8 +105,8 @@ class ApiRolesRoleIndexHandler(BaseApiHandler): return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"}) try: - data = orjson.loads(self.request.body) # pylint: disable=no-member - except orjson.decoder.JSONDecodeError as e: # pylint: disable=no-member + data = orjson.loads(self.request.body) + except orjson.decoder.JSONDecodeError as e: return self.finish_json( 400, {"status": "error", "error": "INVALID_JSON", "error_data": str(e)} ) diff --git a/app/classes/web/routes/api/servers/index.py b/app/classes/web/routes/api/servers/index.py index 0351c56c..f3789f62 100644 --- a/app/classes/web/routes/api/servers/index.py +++ b/app/classes/web/routes/api/servers/index.py @@ -647,8 +647,8 @@ class ApiServersIndexHandler(BaseApiHandler): return self.finish_json(400, {"status": "error", "error": "NOT_AUTHORIZED"}) try: - data = orjson.loads(self.request.body) # pylint: disable=no-member - except orjson.decoder.JSONDecodeError as e: # pylint: disable=no-member + data = orjson.loads(self.request.body) + except orjson.decoder.JSONDecodeError as e: return self.finish_json( 400, {"status": "error", "error": "INVALID_JSON", "error_data": str(e)} )