Adjust YAML loading for PyYAML 5.1

This commit is contained in:
Florian Bruhin 2019-03-18 20:48:48 +01:00
parent f9a98644ce
commit 9cd58b290d
3 changed files with 5 additions and 5 deletions

View File

@ -309,7 +309,7 @@ You can use:
import yaml
with (config.configdir / 'config.yml').open() as f:
yaml_data = yaml.load(f)
yaml_data = yaml.safe_load(f)
for k, v in yaml_data.items():
config.set(k, v)
@ -339,7 +339,7 @@ You can use:
import yaml
with (config.configdir / 'colors.yml').open() as f:
yaml_data = yaml.load(f)
yaml_data = yaml.safe_load(f)
def dict_attrs(obj, path=''):
if isinstance(obj, dict):

View File

@ -81,4 +81,4 @@ def register(linter):
FAILED_LOAD = True
return
with yaml_file.open(mode='r', encoding='utf-8') as f:
OPTIONS = list(yaml.load(f))
OPTIONS = list(yaml.safe_load(f))

View File

@ -167,7 +167,7 @@ class TestParseYamlType:
def _yaml(self, s):
"""Get the type from parsed YAML data."""
return yaml.load(textwrap.dedent(s))['type']
return yaml.safe_load(textwrap.dedent(s))['type']
def test_simple(self):
"""Test type which is only a name."""
@ -254,7 +254,7 @@ class TestParseYamlBackend:
def _yaml(self, s):
"""Get the type from parsed YAML data."""
return yaml.load(textwrap.dedent(s))['backend']
return yaml.safe_load(textwrap.dedent(s))['backend']
@pytest.mark.parametrize('backend, expected', [
('QtWebKit', [usertypes.Backend.QtWebKit]),