Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updaed yaml.load(file) to yaml.safe_load(file). #3101

Merged
merged 1 commit into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions services/core/DNP3Agent/dnp3/mesa/conversion.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import sys, yaml, json

y=yaml.load(sys.stdin.read())
print(json.dumps(y))
y=yaml.safe_load(sys.stdin.read())
print(json.dumps(y))
2 changes: 1 addition & 1 deletion services/core/DNP3Agent/dnp3/mesa/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def load_functions_from_yaml_file(self, function_definitions_path):
self._functions = {}
try:
with open(fdef_path, 'r') as f:
self.load_functions(yaml.load(f)['functions'])
self.load_functions(yaml.safe_load(f)['functions'])
except Exception as err:
raise ValueError('Problem parsing {}. Error={}'.format(fdef_path, err))
_log.debug('Loaded {} FunctionDefinitions'.format(len(self._functions.keys())))
Expand Down
2 changes: 1 addition & 1 deletion services/core/DNP3Agent/tests/test_mesa_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def add_definitions_to_config_store(test_agent):
test_agent.vip.rpc.call('config.store', 'manage_store', MESA_AGENT_ID,
'mesa_points.config', points_json, config_type='raw')
with open(FUNCTION_DEFINITIONS_PATH, 'r') as f:
functions_json = yaml.load(f.read())
functions_json = yaml.safe_load(f.read())
test_agent.vip.rpc.call('config.store', 'manage_store', MESA_AGENT_ID,
'mesa_functions.config', functions_json, config_type='raw')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def set_device_type_maps(self):
yaml_file = "{0}/{1}".format(self._directories['map_dir'], file_name)
if file_name and os.stat(yaml_file).st_size:
with open("{0}/maps.yaml".format(self._directories['map_dir'])) as yaml_file:
device_type_maps = yaml.load(yaml_file)
device_type_maps = yaml.safe_load(yaml_file)
return device_type_maps

def _sh(self, shell_command):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def __init__(self):
yaml_path = os.path.dirname(__file__) + '/' + yaml_path

with open(yaml_path, 'rb') as yaml_file:
for map in yaml.load(yaml_file):
for map in yaml.safe_load(yaml_file):
map = dict((k.lower(), v) for k, v in map.items())
Catalog._data[map['name']] = Map(file=map.get('file', ''),
map_dir=os.path.dirname(__file__),
Expand Down
2 changes: 1 addition & 1 deletion volttron/platform/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def configure_logging(conf_path):
return (conf_path, 'PyYAML must be installed before '
'loading logging configuration from a YAML file.')
try:
conf_dict = yaml.load(conf_file)
conf_dict = yaml.safe_load(conf_file)
except yaml.YAMLError as exc:
return conf_path, exc
try:
Expand Down
Loading