Skip to content

Commit

Permalink
yaml.load -> yaml.safe_load
Browse files Browse the repository at this point in the history
  • Loading branch information
tano297 committed Aug 9, 2019
1 parent 8cf091b commit 5368eed
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion train/auxiliary/calculate_means_stds.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def is_image(filename):
if(FLAGS.cfg):
print("Opening config file %s" % FLAGS.cfg)
with open(FLAGS.cfg, 'r') as file:
CFG = yaml.load(file)
CFG = yaml.safe_load(file)
except Exception as e:
print(e)
print("Error opening yaml file.")
Expand Down
2 changes: 1 addition & 1 deletion train/auxiliary/calculate_segmentation_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def is_image(filename):
if(FLAGS.cfg):
print("Opening config file %s" % FLAGS.cfg)
with open(FLAGS.cfg, 'r') as file:
CFG = yaml.load(file)
CFG = yaml.safe_load(file)
FLAGS.numclasses = len(CFG["dataset"]["labels"])
except Exception as e:
print(e)
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/classification/modules/traceSaver.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, path, new_path, force_img_prop=(None, None)):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/classification/modules/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, path, force_img_prop=(None, None)):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/classification/modules/userCaffe2.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, path):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/classification/modules/userPytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, path):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/classification/modules/userTensorRT.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, path, workspace, calib_dataset=None):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/classification/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
print("Opening default data file cfg.yaml from log folder")
f = open(FLAGS.path + '/cfg.yaml', 'r')
configfile = FLAGS.path + '/cfg.yaml'
CFG = yaml.load(f)
CFG = yaml.safe_load(f)
except Exception as e:
print(e)
print("Error opening yaml file.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/segmentation/dataset/coco/generate_gt.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def is_image(filename):
try:
print("Opening config file")
with open('cfg.yaml', 'r') as file:
CFG = yaml.load(file)
CFG = yaml.safe_load(file)
except Exception as e:
print(e)
print("Error opening yaml file.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/segmentation/modules/traceSaver.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self, path, new_path, force_img_prop=(None, None)):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/segmentation/modules/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, path, force_img_prop=(None, None)):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/segmentation/modules/userCaffe2.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self, path):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/segmentation/modules/userPytorch.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, path):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/segmentation/modules/userTensorRT.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, path, workspace, calib_dataset=None):
try:
yaml_path = self.path + "/cfg.yaml"
print("Opening config file %s" % yaml_path)
self.CFG = yaml.load(open(yaml_path, 'r'))
self.CFG = yaml.safe_load(open(yaml_path, 'r'))
except Exception as e:
print(e)
print("Error opening cfg.yaml file from trained model.")
Expand Down
2 changes: 1 addition & 1 deletion train/tasks/segmentation/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
print("Opening default data file cfg.yaml from log folder")
f = open(FLAGS.path + '/cfg.yaml', 'r')
configfile = FLAGS.path + '/cfg.yaml'
CFG = yaml.load(f)
CFG = yaml.safe_load(f)
except Exception as e:
print(e)
print("Error opening yaml file.")
Expand Down

0 comments on commit 5368eed

Please sign in to comment.