From 50d282ff3729e102b1191fccdece63f44be2ae5a Mon Sep 17 00:00:00 2001 From: BackSlasher <nitz.raz@gmail.com> Date: Sat, 15 Jun 2019 01:30:47 +0300 Subject: [PATCH] Pyyaml5.1 (#24529) * Migrated to PyYAML 5.1 * More intelligent fixing of yaml safe_load Based on https://circleci.com/gh/home-assistant/home-assistant/34831?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link --- homeassistant/components/kira/__init__.py | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- setup.py | 2 +- tests/components/apns/test_notify.py | 2 +- tests/components/scene/test_init.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/kira/__init__.py b/homeassistant/components/kira/__init__.py index 7cf27d342f5..723a13e426a 100644 --- a/homeassistant/components/kira/__init__.py +++ b/homeassistant/components/kira/__init__.py @@ -60,7 +60,7 @@ def load_codes(path): codes = [] if os.path.exists(path): with open(path) as code_file: - data = yaml.load(code_file) or [] + data = yaml.safe_load(code_file) or [] for code in data: try: codes.append(CODE_SCHEMA(code)) diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 619c6fad581..9e83ca6fd0e 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -17,7 +17,7 @@ netdisco==2.6.0 pip>=8.0.3 python-slugify==3.0.2 pytz>=2019.01 -pyyaml>=3.13,<4 +pyyaml==5.1 requests==2.22.0 ruamel.yaml==0.15.97 sqlalchemy==1.3.3 diff --git a/requirements_all.txt b/requirements_all.txt index b973695cba3..2c4920a2469 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -12,7 +12,7 @@ cryptography==2.6.1 pip>=8.0.3 python-slugify==3.0.2 pytz>=2019.01 -pyyaml>=3.13,<4 +pyyaml==5.1 requests==2.22.0 ruamel.yaml==0.15.97 voluptuous==0.11.5 diff --git a/setup.py b/setup.py index d9c13524070..3278ec197d4 100755 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ REQUIRES = [ 'pip>=8.0.3', 'python-slugify==3.0.2', 'pytz>=2019.01', - 'pyyaml>=3.13,<4', + 'pyyaml==5.1', 'requests==2.22.0', 'ruamel.yaml==0.15.97', 'voluptuous==0.11.5', diff --git a/tests/components/apns/test_notify.py b/tests/components/apns/test_notify.py index 7303f4872e3..3f8d00f8f50 100644 --- a/tests/components/apns/test_notify.py +++ b/tests/components/apns/test_notify.py @@ -400,7 +400,7 @@ def test_write_device(): device = apns.ApnsDevice('123', 'name', 'track_id', True) apns._write_device(out, device) - data = yaml.load(out.getvalue()) + data = yaml.safe_load(out.getvalue()) assert data == { 123: { 'name': 'name', diff --git a/tests/components/scene/test_init.py b/tests/components/scene/test_init.py index 99364d51e6c..94746cce0f0 100644 --- a/tests/components/scene/test_init.py +++ b/tests/components/scene/test_init.py @@ -90,7 +90,7 @@ class TestScene(unittest.TestCase): self.light_1.entity_id, self.light_2.entity_id) with io.StringIO(config) as file: - doc = yaml_loader.yaml.load(file) + doc = yaml_loader.yaml.safe_load(file) assert setup_component(self.hass, scene.DOMAIN, doc) common.activate(self.hass, 'scene.test') -- GitLab