Skip to content

Commit 9c354a6

Browse files
author
Chris Elion
authored
use yaml.safe_load instead of yaml.load (#2124)
1 parent bce6e29 commit 9c354a6

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

ml-agents/mlagents/trainers/learn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def prepare_for_docker_run(docker_target_name, env_path):
154154
def load_config(trainer_config_path):
155155
try:
156156
with open(trainer_config_path) as data_file:
157-
trainer_config = yaml.load(data_file)
157+
trainer_config = yaml.safe_load(data_file)
158158
return trainer_config
159159
except IOError:
160160
raise UnityEnvironmentException(

ml-agents/mlagents/trainers/tests/test_bc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
@pytest.fixture
1515
def dummy_config():
16-
return yaml.load(
16+
return yaml.safe_load(
1717
"""
1818
hidden_units: 128
1919
learning_rate: 3.0e-4

ml-agents/mlagents/trainers/tests/test_ppo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
@pytest.fixture
1616
def dummy_config():
17-
return yaml.load(
17+
return yaml.safe_load(
1818
"""
1919
trainer: ppo
2020
batch_size: 32

ml-agents/mlagents/trainers/tests/test_trainer_controller.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@pytest.fixture
1818
def dummy_config():
19-
return yaml.load(
19+
return yaml.safe_load(
2020
"""
2121
default:
2222
trainer: ppo
@@ -46,7 +46,7 @@ def dummy_config():
4646

4747
@pytest.fixture
4848
def dummy_online_bc_config():
49-
return yaml.load(
49+
return yaml.safe_load(
5050
"""
5151
default:
5252
trainer: online_bc
@@ -78,7 +78,7 @@ def dummy_online_bc_config():
7878

7979
@pytest.fixture
8080
def dummy_offline_bc_config():
81-
return yaml.load(
81+
return yaml.safe_load(
8282
"""
8383
default:
8484
trainer: offline_bc
@@ -120,7 +120,7 @@ def dummy_offline_bc_config_with_override():
120120

121121
@pytest.fixture
122122
def dummy_bad_config():
123-
return yaml.load(
123+
return yaml.safe_load(
124124
"""
125125
default:
126126
trainer: incorrect_trainer

0 commit comments

Comments
 (0)