Skip to content

Commit

Permalink
use the recommended yaml.safe_load function
Browse files Browse the repository at this point in the history
reason: with pyyaml >= 5, the load function without Loader is deprecated.
Even if we do not use version 5 for now, we should use good practices.
https://pyyaml.org/wiki/PyYAMLDocumentation#loading-yaml
yaml/pyyaml#257
  • Loading branch information
fblackburn1 committed Apr 16, 2019
1 parent 86343d5 commit 07fa2ea
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion integration_tests/suite/test_csv_backend.py
Expand Up @@ -28,7 +28,7 @@ class _BaseCSVFileTestCase(unittest.TestCase):
def setUp(self):
config_file = absolute_file_name(self.asset, self.source_config)
with open(config_file) as f:
config = {'config': yaml.load(f)}
config = {'config': yaml.safe_load(f)}
config['config']['file'] = absolute_file_name(self.asset, config['config']['file'][1:])
self.backend = BackendWrapper('csv', config)
super().setUp()
Expand Down
2 changes: 1 addition & 1 deletion wazo_dird/plugins/api/http.py
Expand Up @@ -23,7 +23,7 @@ def get(self):
for module in iter_entry_points(group=self.api_entry_point):
try:
plugin_package = module.module_name.rsplit('.', 1)[0]
spec = yaml.load(resource_string(plugin_package, self.api_filename))
spec = yaml.safe_load(resource_string(plugin_package, self.api_filename))
if not spec:
logger.debug('plugin has no API spec: %s', plugin_package)
else:
Expand Down
2 changes: 1 addition & 1 deletion wazo_dird/plugins/service_discovery_service/plugin.py
Expand Up @@ -204,4 +204,4 @@ def generate_from_new_service(self, service, uuid, host, port):
template_args['port'] = port

yaml_representation = template.render(template_args)
return yaml.load(yaml_representation)
return yaml.safe_load(yaml_representation)

0 comments on commit 07fa2ea

Please sign in to comment.