Skip to content

Commit

Permalink
Upgrade to PyYaml 5.1 (Sceptre#681)
Browse files Browse the repository at this point in the history
Updates the PyYaml version to 5.1.

Adds in YamlLoader as per yaml/pyyaml#292

Other incompatible changes were reviewed
(yaml/pyyaml#265) and the yaml.Loader appears
to the be only concern for now.

[Resolves Sceptre#665]
  • Loading branch information
ngfgrant authored and thawkson committed Feb 6, 2021
1 parent c52d96b commit 871a76f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packaging==16.8
pygments==2.2.0
pytest-runner>=3.0.0,<3.1.0
pytest>=3.2.0,<3.3.0
PyYaml>=4.2b1,<5.0
PyYaml>=5.1,<6.0
readme-renderer>=24.0
setuptools>=40.6.2
six>=1.11.0,<2.0.0
Expand Down
14 changes: 8 additions & 6 deletions sceptre/cli/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,21 @@ def _generate_yaml(stream):
try:
if isinstance(item, dict):
items.append(
yaml.safe_dump(item, default_flow_style=False, explicit_start=True)
yaml.safe_dump(item, default_flow_style=False, explicit_start=True)
)
else:
items.append(
yaml.safe_dump(
yaml.load(item), default_flow_style=False, explicit_start=True)
yaml.safe_dump(
yaml.load(item, Loader=yaml.FullLoader),
default_flow_style=False, explicit_start=True
)
)
except Exception:
print("An error occured whilst writing the YAML object.")
return yaml.safe_dump(
[yaml.load(item) for item in items],
default_flow_style=False, explicit_start=True
)
[yaml.load(item, Loader=yaml.FullLoader) for item in items],
default_flow_style=False, explicit_start=True
)
else:
try:
return yaml.safe_loads(stream)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
install_requirements = [
"boto3>=1.3,<2.0",
"click==7.0",
"PyYaml>=4.2b1,<5.0",
"PyYaml>=5.1,<6.0",
"Jinja2>=2.8,<3",
"packaging==16.8",
"colorama==0.3.9",
Expand Down

0 comments on commit 871a76f

Please sign in to comment.