Skip to content

Commit

Permalink
safe yaml loader
Browse files Browse the repository at this point in the history
  • Loading branch information
jpreiss committed Jun 6, 2024
1 parent beb0549 commit f7f169a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ros_ws/src/crazyswarm/scripts/chooser.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
def read_by_id(path):
by_id = {}
with open(path, 'r') as ymlfile:
root = yaml.load(ymlfile)
root = yaml.load(ymlfile, Loader=yaml.SafeLoader)
for node in root["crazyflies"]:
id = int(node["id"])
by_id[id] = node
Expand All @@ -63,7 +63,7 @@ def save():
allCrazyflies = read_by_id(os.path.join(args.configpath, "allCrazyflies.yaml"))
enabled = read_by_id(os.path.join(args.configpath, "crazyflies.yaml")).keys()
with open(os.path.join(args.configpath, "crazyflieTypes.yaml"), 'r') as ymlfile:
data = yaml.load(ymlfile)
data = yaml.load(ymlfile, Loader=yaml.SafeLoader)
cfTypes = data["crazyflieTypes"]

# compute absolute pixel coordinates from the initial positions
Expand Down
4 changes: 2 additions & 2 deletions ros_ws/src/crazyswarm/scripts/pycrazyswarm/crazyflie.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,9 @@ def __init__(self, crazyflies_yaml="../launch/crazyflies.yaml"):

if crazyflies_yaml.endswith(".yaml"):
with open(crazyflies_yaml, 'r') as ymlfile:
cfg = yaml.load(ymlfile)
cfg = yaml.load(ymlfile, Loader=yaml.SafeLoader)
else:
cfg = yaml.load(crazyflies_yaml)
cfg = yaml.load(crazyflies_yaml, Loader=yaml.SafeLoader)

self.tf = TransformListener()

Expand Down

0 comments on commit f7f169a

Please sign in to comment.