Skip to content

Commit

Permalink
Merge pull request #1630 from HEXRD/yaml-safe-dump
Browse files Browse the repository at this point in the history
Use yaml.safe_dump or NumpyToNativeDumper
  • Loading branch information
psavery authored Dec 2, 2023
2 parents fca2ca7 + ad81d7a commit 56529c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion hexrdgui/hexrd_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from hexrd.instrument import HEDMInstrument
from hexrd.material import load_materials_hdf5, save_materials_hdf5, Material
from hexrd.rotations import RotMatEuler
from hexrd.utils.yaml import NumpyToNativeDumper
from hexrd.valunits import valWUnit

from hexrdgui import constants
Expand Down Expand Up @@ -1154,7 +1155,7 @@ def recursive_key_check(d, c):
cfg['working_dir'] = '.'

with open(output_file, 'w') as f:
yaml.dump(cfg, f)
yaml.dump(cfg, f, Dumper=NumpyToNativeDumper)

def create_internal_config(self, cur_config):
if not self.has_status(cur_config):
Expand Down
4 changes: 2 additions & 2 deletions hexrdgui/image_file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def open_file(self, f, options=None):
input_dict['meta'] = {}
temp = tempfile.NamedTemporaryFile(delete=False)
try:
data = yaml.dump(input_dict).encode('utf-8')
data = yaml.safe_dump(input_dict).encode('utf-8')
temp.write(data)
temp.close()
ims = imageseries.open(temp.name, 'image-files')
Expand Down Expand Up @@ -129,7 +129,7 @@ def open_directory(self, d, files=None, options=None):
input_dict['meta'] = {}
temp = tempfile.NamedTemporaryFile(delete=False)
try:
data = yaml.dump(input_dict).encode('utf-8')
data = yaml.safe_dump(input_dict).encode('utf-8')
temp.write(data)
temp.close()
ims = imageseries.open(temp.name, 'image-files')
Expand Down

0 comments on commit 56529c6

Please sign in to comment.