Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-dotmap for openSUSE:Factory checked in at 2022-09-29 18:12:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-dotmap (Old) and /work/SRC/openSUSE:Factory/.python-dotmap.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-dotmap" Thu Sep 29 18:12:08 2022 rev:6 rq:1006515 version:1.3.30 Changes: -------- --- /work/SRC/openSUSE:Factory/python-dotmap/python-dotmap.changes 2022-01-15 20:05:39.885780752 +0100 +++ /work/SRC/openSUSE:Factory/.python-dotmap.new.2275/python-dotmap.changes 2022-09-29 18:12:19.487134236 +0200 @@ -1,0 +2,13 @@ +Tue Sep 27 18:59:25 UTC 2022 - Yogalakshmi Arunachalam <[email protected]> + +- update to 1.3.30 + * apply _key_convert_hook to nested fields (#90) + * add key convert hook (#89) + * Revert "fix issue #85 (#86)" (#88) + * Fix indent (#87) + * fix issue #85 (#86) + * fix issue #85 + Handle keys with dashes/dots by replacing them with underlines + * fix typo + +------------------------------------------------------------------- Old: ---- dotmap-1.3.26.tar.gz New: ---- dotmap-1.3.30.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-dotmap.spec ++++++ --- /var/tmp/diff_new_pack.HsJ7zT/_old 2022-09-29 18:12:20.023135284 +0200 +++ /var/tmp/diff_new_pack.HsJ7zT/_new 2022-09-29 18:12:20.031135299 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-dotmap -Version: 1.3.26 +Version: 1.3.30 Release: 0 Summary: Python ordered, dynamically-expandable dot-access dictionary License: MIT ++++++ dotmap-1.3.26.tar.gz -> dotmap-1.3.30.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dotmap-1.3.26/PKG-INFO new/dotmap-1.3.30/PKG-INFO --- old/dotmap-1.3.26/PKG-INFO 2021-12-10 15:29:14.237851100 +0100 +++ new/dotmap-1.3.30/PKG-INFO 2022-04-06 18:26:43.891283000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: dotmap -Version: 1.3.26 +Version: 1.3.30 Summary: ordered, dynamically-expandable dot-access dictionary Home-page: https://github.com/drgrib/dotmap Author: Chris Redford diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dotmap-1.3.26/dotmap/__init__.py new/dotmap-1.3.30/dotmap/__init__.py --- old/dotmap-1.3.26/dotmap/__init__.py 2021-10-14 15:52:30.000000000 +0200 +++ new/dotmap-1.3.30/dotmap/__init__.py 2022-04-06 18:26:22.000000000 +0200 @@ -23,6 +23,8 @@ self._map = OrderedDict() self._dynamic = kwargs.pop('_dynamic', True) self._prevent_method_masking = kwargs.pop('_prevent_method_masking', False) + + _key_convert_hook = kwargs.pop('_key_convert_hook', None) trackedIDs = kwargs.pop('_trackedIDs', {}) if args: @@ -39,13 +41,15 @@ for k,v in src: if self._prevent_method_masking and k in reserved_keys: raise KeyError('"{}" is reserved'.format(k)) + if _key_convert_hook: + k = _key_convert_hook(k) if isinstance(v, dict): idv = id(v) if idv in trackedIDs: v = trackedIDs[idv] else: trackedIDs[idv] = v - v = self.__class__(v, _dynamic=self._dynamic, _prevent_method_masking = self._prevent_method_masking, _trackedIDs = trackedIDs) + v = self.__class__(v, _dynamic=self._dynamic, _prevent_method_masking = self._prevent_method_masking, _key_convert_hook =_key_convert_hook, _trackedIDs = trackedIDs) if type(v) is list: l = [] for i in v: @@ -56,7 +60,7 @@ n = trackedIDs[idi] else: trackedIDs[idi] = i - n = self.__class__(i, _dynamic=self._dynamic, _prevent_method_masking = self._prevent_method_masking) + n = self.__class__(i, _dynamic=self._dynamic, _key_convert_hook =_key_convert_hook, _prevent_method_masking = self._prevent_method_masking) l.append(n) v = l self._map[k] = v @@ -64,6 +68,8 @@ for k,v in self.__call_items(kwargs): if self._prevent_method_masking and k in reserved_keys: raise KeyError('"{}" is reserved'.format(k)) + if _key_convert_hook: + k = _key_convert_hook(k) self._map[k] = v def __call_items(self, obj): @@ -666,7 +672,7 @@ raise RuntimeError("this should fail with KeyError") except KeyError: print('nested dict attrib masking ok') - + print('\n== DotMap __init__, toDict, and __str__ with circular references ==') a = { 'name': 'a'} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dotmap-1.3.26/dotmap/test.py new/dotmap-1.3.30/dotmap/test.py --- old/dotmap-1.3.26/dotmap/test.py 2021-10-14 15:52:30.000000000 +0200 +++ new/dotmap-1.3.30/dotmap/test.py 2022-04-06 18:26:22.000000000 +0200 @@ -383,3 +383,28 @@ p.my_prop.second.third = 456 self.assertIsInstance(p.my_prop.second, PropertyDotMap) self.assertEqual(p.my_prop.second.third, 456) + +class TestKeyConvertHook(unittest.TestCase): + def fix_illegal_key(self, key): + return key.replace(".", "_").replace("-","_") + + def test(self): + # by default key_convert_hook = None + d = DotMap({"dot.map":123}, _dynamic=False) + self.assertRaises(AttributeError, lambda: d.dot.map) + + # replace @ with _ + d = DotMap({"dot@map":"dot_map"}, _key_convert_hook = lambda k: k.replace('@','_')) + self.assertEqual(d.dot_map, "dot_map") + + # replace multiple keys, apply to nested fields + d = DotMap({"dot@map":{"dot!map":"dot_map"}}, _key_convert_hook = lambda k: k.replace('@','_').replace('!','_')) + self.assertEqual(d.dot_map.dot_map, "dot_map") + + # replace multiple keys with a _key_convert_hook function + d = DotMap({"dot-map":123}, _key_convert_hook = self.fix_illegal_key) + self.assertEqual(d.dot_map, 123) + + # replace the entire key with another one + d = DotMap({"dot!map":456}, _key_convert_hook = lambda k: 'DOTMAP' if k == 'dot!map' else k) + self.assertEqual(d.DOTMAP, 456) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dotmap-1.3.26/dotmap.egg-info/PKG-INFO new/dotmap-1.3.30/dotmap.egg-info/PKG-INFO --- old/dotmap-1.3.26/dotmap.egg-info/PKG-INFO 2021-12-10 15:29:12.000000000 +0100 +++ new/dotmap-1.3.30/dotmap.egg-info/PKG-INFO 2022-04-06 18:26:43.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: dotmap -Version: 1.3.26 +Version: 1.3.30 Summary: ordered, dynamically-expandable dot-access dictionary Home-page: https://github.com/drgrib/dotmap Author: Chris Redford diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dotmap-1.3.26/setup.py new/dotmap-1.3.30/setup.py --- old/dotmap-1.3.26/setup.py 2021-12-10 15:29:03.000000000 +0100 +++ new/dotmap-1.3.30/setup.py 2022-04-06 18:26:33.000000000 +0200 @@ -4,7 +4,7 @@ long_description = fh.read() setup( - version = '1.3.26', + version = '1.3.30', name='dotmap', packages=['dotmap'], # this must be the same as the name above description='ordered, dynamically-expandable dot-access dictionary',
