From c4e5d69044f1941c2af5b06fe8fea12ddd6d3e88 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 12 Aug 2019 15:49:14 +0200 Subject: [PATCH] Tools: Update PyYAML version. (#2279) Fixes #2278. --- tools/generation/lib/template.py | 6 +++--- tools/generation/requirements.txt | 2 +- tools/lint/lib/checks/harnessfeatures.py | 2 +- tools/lint/lib/frontmatter.py | 2 +- tools/lint/requirements.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/generation/lib/template.py b/tools/generation/lib/template.py index c0a12ccf02..88e92a9d72 100644 --- a/tools/generation/lib/template.py +++ b/tools/generation/lib/template.py @@ -154,20 +154,20 @@ class Template: features += self.attribs['meta'].get('features', []) features = list(OrderedDict.fromkeys(features)) if len(features): - lines += ['features: ' + re.sub('\n\s*', ' ', yaml.dump(features).strip())] + lines += ['features: ' + re.sub('\n\s*', ' ', yaml.dump(features, default_flow_style=True).strip())] flags = ['generated'] flags += case_values['meta'].get('flags', []) flags += self.attribs['meta'].get('flags', []) flags = list(OrderedDict.fromkeys(flags)) - lines += ['flags: ' + re.sub('\n\s*', ' ', yaml.dump(flags).strip())] + lines += ['flags: ' + re.sub('\n\s*', ' ', yaml.dump(flags, default_flow_style=True).strip())] includes = [] includes += case_values['meta'].get('includes', []) includes += self.attribs['meta'].get('includes', []) includes = list(OrderedDict.fromkeys(includes)) if len(includes): - lines += ['includes: ' + re.sub('\n\s*', ' ', yaml.dump(includes).strip())] + lines += ['includes: ' + re.sub('\n\s*', ' ', yaml.dump(includes, default_flow_style=True).strip())] if case_values['meta'].get('negative'): if self.attribs['meta'].get('negative'): diff --git a/tools/generation/requirements.txt b/tools/generation/requirements.txt index efb082d8de..14ff634402 100644 --- a/tools/generation/requirements.txt +++ b/tools/generation/requirements.txt @@ -1 +1 @@ -PyYAML==3.11 +PyYAML==5.1.2 diff --git a/tools/lint/lib/checks/harnessfeatures.py b/tools/lint/lib/checks/harnessfeatures.py index 18d7dd0fd8..dc33f6beee 100644 --- a/tools/lint/lib/checks/harnessfeatures.py +++ b/tools/lint/lib/checks/harnessfeatures.py @@ -9,7 +9,7 @@ class CheckHarnessFeatures(Check): def __init__(self): with open('./harness/features.yml', 'r') as f: - self.include_has_features = yaml.load(f.read()) + self.include_has_features = yaml.safe_load(f.read()) def comparison_result_lists(self, meta): diff --git a/tools/lint/lib/frontmatter.py b/tools/lint/lib/frontmatter.py index 34edd1eac6..a43b605cb2 100644 --- a/tools/lint/lib/frontmatter.py +++ b/tools/lint/lib/frontmatter.py @@ -11,6 +11,6 @@ def parse(src): return None try: - return yaml.load(match.group(1)) + return yaml.safe_load(match.group(1)) except (yaml.scanner.ScannerError, yaml.parser.ParserError): return None diff --git a/tools/lint/requirements.txt b/tools/lint/requirements.txt index 8ad7322903..6d47921fad 100644 --- a/tools/lint/requirements.txt +++ b/tools/lint/requirements.txt @@ -1,2 +1,2 @@ -PyYAML==3.11 +PyYAML==5.1.2 inflect==0.2.5