mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-15 17:20:05 +00:00
migrate to yaml.safe_dump
This commit is contained in:
@@ -569,8 +569,9 @@ class Cfg:
|
|||||||
"""writes the config to file"""
|
"""writes the config to file"""
|
||||||
ret = False
|
ret = False
|
||||||
with open(path, 'w') as f:
|
with open(path, 'w') as f:
|
||||||
ret = yaml.dump(content, f,
|
ret = yaml.safe_dump(content, f,
|
||||||
default_flow_style=False, indent=2)
|
default_flow_style=False,
|
||||||
|
indent=2)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def _norm_key_elem(self, elem):
|
def _norm_key_elem(self, elem):
|
||||||
@@ -827,7 +828,9 @@ class Cfg:
|
|||||||
self.lnk_settings[self.key_dotpath] = self.curdotpath
|
self.lnk_settings[self.key_dotpath] = self.curdotpath
|
||||||
self.lnk_settings[self.key_workdir] = self.curworkdir
|
self.lnk_settings[self.key_workdir] = self.curworkdir
|
||||||
# dump
|
# dump
|
||||||
ret = yaml.dump(self.content, default_flow_style=False, indent=2)
|
ret = yaml.safe_dump(self.content,
|
||||||
|
default_flow_style=False,
|
||||||
|
indent=2)
|
||||||
ret = ret.replace('{}', '')
|
ret = ret.replace('{}', '')
|
||||||
# restore paths
|
# restore paths
|
||||||
self.lnk_settings[self.key_dotpath] = dotpath
|
self.lnk_settings[self.key_dotpath] = dotpath
|
||||||
|
|||||||
@@ -79,7 +79,8 @@ class TestConfig(unittest.TestCase):
|
|||||||
|
|
||||||
# save the new config
|
# save the new config
|
||||||
with open(confpath, 'w') as f:
|
with open(confpath, 'w') as f:
|
||||||
yaml.dump(content, f, default_flow_style=False, indent=2)
|
yaml.safe_dump(content, f, default_flow_style=False,
|
||||||
|
indent=2)
|
||||||
|
|
||||||
# do the tests
|
# do the tests
|
||||||
conf = Cfg(confpath)
|
conf = Cfg(confpath)
|
||||||
@@ -109,7 +110,8 @@ class TestConfig(unittest.TestCase):
|
|||||||
|
|
||||||
# save the new config
|
# save the new config
|
||||||
with open(confpath, 'w') as f:
|
with open(confpath, 'w') as f:
|
||||||
yaml.dump(content, f, default_flow_style=False, indent=2)
|
yaml.safe_dump(content, f, default_flow_style=False,
|
||||||
|
indent=2)
|
||||||
|
|
||||||
# do the tests
|
# do the tests
|
||||||
conf = Cfg(confpath)
|
conf = Cfg(confpath)
|
||||||
|
|||||||
Reference in New Issue
Block a user