From a425fa6626c37d2fa7aac9352c49682973974a77 Mon Sep 17 00:00:00 2001 From: Al Bailey Date: Wed, 31 May 2023 16:36:27 +0000 Subject: [PATCH] Support newer version of yaml yaml.load will report a warning in pyyaml 5 and an error in pyyaml 6 if it is called without a Loader argument. The no-member pylint error was being suppressed due to legacy http code, so now that is un-suppressed globally and the yaml.load is replaced with yaml.safe_load Test Plan: PASS: tox PASS: yaml.load('events.yaml') returns the same content as yaml.safe_load('events.yaml') Story: 2010642 Task: 48157 Signed-off-by: Al Bailey Change-Id: Ibac118cd9555f3334251b10a6b3e0a5986285854 --- fm-common/sources/fm_db_sync_event_suppression.py | 2 +- pylint.rc | 3 +-- python-fmclient/fmclient/fmclient/common/http.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/fm-common/sources/fm_db_sync_event_suppression.py b/fm-common/sources/fm_db_sync_event_suppression.py index 2ce7ec78..553636a1 100755 --- a/fm-common/sources/fm_db_sync_event_suppression.py +++ b/fm-common/sources/fm_db_sync_event_suppression.py @@ -107,7 +107,7 @@ if not os.path.isfile(EVENT_TYPES_FILE): try: with open(EVENT_TYPES_FILE, 'r') as stream: - event_types = yaml.load(stream) + event_types = yaml.safe_load(stream) except Exception as exp: LOG.error(exp) raise RuntimeError(exp) diff --git a/pylint.rc b/pylint.rc index 69214dd0..f3cc3fd4 100755 --- a/pylint.rc +++ b/pylint.rc @@ -71,7 +71,6 @@ extension-pkg-whitelist=lxml.etree,greenlet # E0604 invalid-all-object # E1101 no-member # E1102 not-callable -# E1120 no-value-for-parameter # E1121 too-many-function-args # E1123 unexpected-keyword-arg # NOTE: these are suppressed until py3 support merges: @@ -80,7 +79,7 @@ disable=C, R, fixme, W0102,W0106,W0107,W0201,W0212,W0221,W0223,W0231, W0237,W0235,W0311,W0602,W0603,W0612,W0613,W0621,W0622, W0703,W0707,W0719,W1401,W0143,W1505,W1514,W1618,E0604,E0611,E0702,E1136, - E0401,E0604,E1101,E1102,E1120,E1121,E1123 + E0401,E0604,E1101,E1102,E1121,E1123 [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs diff --git a/python-fmclient/fmclient/fmclient/common/http.py b/python-fmclient/fmclient/fmclient/common/http.py index c8b3b4d5..2f7f54e8 100644 --- a/python-fmclient/fmclient/fmclient/common/http.py +++ b/python-fmclient/fmclient/fmclient/common/http.py @@ -104,7 +104,7 @@ class _BaseHTTPClient(object): resp.request.path_url != '/versions'): # NOTE(flaper87): Eventually, we'll remove the check on `versions` # which is a bug (1491350) on the server. - raise exc.from_response(resp) + raise exc.from_response(resp) # pylint: disable=no-value-for-parameter content_type = resp.headers.get('Content-Type')