From a90995d42711bec2f90896e7141e5007559e4f61 Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Sun, 2 Jun 2019 11:34:29 +0200 Subject: [PATCH] rename trans to trans_read --- dotdrop/cfg_yaml.py | 9 ++++++++- tests/test_import.py | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/dotdrop/cfg_yaml.py b/dotdrop/cfg_yaml.py index b0314a3..1088d53 100644 --- a/dotdrop/cfg_yaml.py +++ b/dotdrop/cfg_yaml.py @@ -24,7 +24,8 @@ class CfgYaml: key_dotfiles = 'dotfiles' key_profiles = 'profiles' key_actions = 'actions' - key_trans_r = 'trans' + old_key_trans_r = 'trans' + key_trans_r = 'trans_read' key_trans_w = 'trans_write' key_variables = 'variables' key_dvariables = 'dynvariables' @@ -126,6 +127,12 @@ class CfgYaml: self.log.dbg('actions: {}'.format(self.actions)) # trans_r + if self.old_key_trans_r in self.yaml_dict: + self.log.warn('\"trans\" is deprecated, please use \"trans_read\"') + self.yaml_dict[self.key_trans_r] = self.yaml_dict.pop( + self.old_key_trans_r + ) + self.dirty = True self.trans_r = self._get_entry(self.yaml_dict, self.key_trans_r, mandatory=False) if self.debug: diff --git a/tests/test_import.py b/tests/test_import.py index 98efdea..bbbfb75 100644 --- a/tests/test_import.py +++ b/tests/test_import.py @@ -352,7 +352,7 @@ class TestImport(unittest.TestCase): self.assertFalse(any(a.endswith('ing') for a in actions)) # testing transformations - transformations = y['trans'].keys() + transformations = y['trans_read'].keys() self.assertTrue(all(t.endswith('ed') for t in transformations)) self.assertFalse(any(t.endswith('ing') for t in transformations)) transformations = y['trans_write'].keys() @@ -394,7 +394,7 @@ class TestImport(unittest.TestCase): self.assertFalse(any(action.endswith('ed') for action in actions)) # testing transformations - transformations = y['trans'].keys() + transformations = y['trans_read'].keys() self.assertTrue(all(t.endswith('ing') for t in transformations)) self.assertFalse(any(t.endswith('ed') for t in transformations)) transformations = y['trans_write'].keys()