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 <al.bailey@windriver.com>
Change-Id: Ibac118cd9555f3334251b10a6b3e0a5986285854
This commit is contained in:
Al Bailey 2023-05-31 16:36:27 +00:00
parent 6172b8ee41
commit a425fa6626
3 changed files with 3 additions and 4 deletions

View File

@ -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)

View File

@ -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

View File

@ -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')