Hello community, here is the log from the commit of package python-munch for openSUSE:Factory checked in at 2018-12-06 12:19:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-munch (Old) and /work/SRC/openSUSE:Factory/.python-munch.new.19453 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-munch" Thu Dec 6 12:19:10 2018 rev:2 rq:655469 version:2.3.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-munch/python-munch.changes 2018-02-14 09:45:53.776335528 +0100 +++ /work/SRC/openSUSE:Factory/.python-munch.new.19453/python-munch.changes 2018-12-06 12:19:13.225397234 +0100 @@ -1,0 +2,29 @@ +Thu Dec 6 05:40:17 UTC 2018 - Thomas Bechtold <[email protected]> + +update to version 2.3.2: + * Add __dict__ property that calls toDict() + * Limit travis deployment conditions + * Implement the pickling interface + * Use flat dicts in __getstate__ (closes #30) + * Ignore pytest cache + * __setattr__ will now munchify() any provided dict + * AutoMunch for automatically converting dicts to Munches + * Drop support for 2.6, 3.3, 3.4 + * Build python wheels + * Avoid running yaml tests when in no-deps environment + * Drop support for Python 2.6, 3.3, 3.4 + * Fix lint in init + * Ignore flycheck files + * Drop the dot in pytest invocation + * Clear and update dict + * Make DefaultFactoryMunch which lets users provide a factory to + generate missing values + * Bump version + * Remove default from constructor and fromDict. Also add a test for repr + +------------------------------------------------------------------- +Tue Dec 4 12:50:36 UTC 2018 - Matej Cepl <[email protected]> + +- Remove superfluous devel dependency for noarch package + +------------------------------------------------------------------- Old: ---- munch-2.2.0.tar.gz New: ---- munch-2.3.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-munch.spec ++++++ --- /var/tmp/diff_new_pack.hzD7Qt/_old 2018-12-06 12:19:13.921396487 +0100 +++ /var/tmp/diff_new_pack.hzD7Qt/_new 2018-12-06 12:19:13.925396483 +0100 @@ -12,29 +12,27 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-munch -Version: 2.2.0 +Version: 2.3.2 Release: 0 Summary: A dot-accessible dictionary License: MIT Group: Development/Languages/Python -Url: http://github.com/Infinidat/munch +URL: http://github.com/Infinidat/munch Source: https://files.pythonhosted.org/packages/source/m/munch/munch-%{version}.tar.gz -BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} +BuildRequires: fdupes BuildRequires: python-rpm-macros +Requires: python-six +BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module six} # /SECTION -BuildRequires: fdupes -Requires: python-six -BuildArch: noarch - %python_subpackages %description @@ -51,7 +49,8 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %files %{python_files} -%doc LICENSE.txt README.md +%license LICENSE.txt +%doc README.md %{python_sitelib}/* %changelog ++++++ munch-2.2.0.tar.gz -> munch-2.3.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.2.0/PKG-INFO new/munch-2.3.2/PKG-INFO --- old/munch-2.2.0/PKG-INFO 2017-07-27 12:07:57.000000000 +0200 +++ new/munch-2.3.2/PKG-INFO 2018-05-06 08:41:31.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: munch -Version: 2.2.0 +Version: 2.3.2 Summary: A dot-accessible dictionary (a la JavaScript objects). Home-page: http://github.com/Infinidat/munch Author: Rotem Yaari @@ -13,12 +13,9 @@ Classifier: Intended Audience :: Developers Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.5 -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 Classifier: Topic :: Software Development Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Utilities diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.2.0/README.md new/munch-2.3.2/README.md --- old/munch-2.2.0/README.md 2017-07-27 12:07:25.000000000 +0200 +++ new/munch-2.3.2/README.md 2018-05-06 08:40:56.000000000 +0200 @@ -114,11 +114,24 @@ True ```` +Or you can use ``DefaultFactoryMunch`` to specify a factory for generating missing attributes. The first argument is the factory: + +````py +>>> b = DefaultFactoryMunch(list, {'hello': 'world!'}) +>>> b.hello +'world!' +>>> b.foo +[] +>>> b.bar.append('hello') +>>> b.bar +['hello'] +```` + Miscellaneous ------------- -* It is safe to ``import *`` from this module. You'll get: ``Munch``, ``DefaultMunch``, ``munchify`` and ``unmunchify``. +* It is safe to ``import *`` from this module. You'll get: ``Munch``, ``DefaultMunch``, ``DefaultFactoryMunch``, ``munchify`` and ``unmunchify``. * Ample Tests. Just run ``pip install tox && tox`` from the project root. Feedback diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.2.0/munch/__init__.py new/munch-2.3.2/munch/__init__.py --- old/munch-2.2.0/munch/__init__.py 2017-07-27 12:07:25.000000000 +0200 +++ new/munch-2.3.2/munch/__init__.py 2018-05-06 08:40:56.000000000 +0200 @@ -21,10 +21,14 @@ converted via Munch.to/fromDict(). """ -__version__ = '2.2.0' +__version__ = '2.3.2' VERSION = tuple(map(int, __version__.split('.'))) -__all__ = ('Munch', 'munchify', 'DefaultMunch', 'unmunchify') +__all__ = ('Munch', 'munchify', 'DefaultMunch', 'DefaultFactoryMunch', 'unmunchify') + + +from collections import defaultdict + from .python3_compat import * # pylint: disable=wildcard-import @@ -163,6 +167,10 @@ """ return unmunchify(self) + @property + def __dict__(self): + return self.toDict() + def __repr__(self): """ Invertible* string-form of a Munch. @@ -185,6 +193,21 @@ def __dir__(self): return list(iterkeys(self)) + def __getstate__(self): + """ Implement a serializable interface used for pickling. + + See https://docs.python.org/3.6/library/pickle.html. + """ + return {k: v for k, v in self.items()} + + def __setstate__(self, state): + """ Implement a serializable interface used for pickling. + + See https://docs.python.org/3.6/library/pickle.html. + """ + self.clear() + self.update(state) + __members__ = __dir__ # for python2.x compatibility @classmethod @@ -203,6 +226,16 @@ return type(self).fromDict(self) +class AutoMunch(Munch): + def __setattr__(self, k, v): + """ Works the same as Munch.__setattr__ but if you supply + a dictionary as value it will convert it to another Munch. + """ + if isinstance(v, dict) and not isinstance(v, (AutoMunch, Munch)): + v = munchify(v, AutoMunch) + super(AutoMunch, self).__setattr__(k, v) + + class DefaultMunch(Munch): """ A Munch that returns a user-specified value for missing keys. @@ -242,6 +275,23 @@ except KeyError: return self.__default__ + def __getstate__(self): + """ Implement a serializable interface used for pickling. + + See https://docs.python.org/3.6/library/pickle.html. + """ + return (self.__default__, {k: v for k, v in self.items()}) + + def __setstate__(self, state): + """ Implement a serializable interface used for pickling. + + See https://docs.python.org/3.6/library/pickle.html. + """ + self.clear() + default, state_dict = state + self.update(state_dict) + self.__default__ = default + @classmethod def fromDict(cls, d, default=None): # pylint: disable=arguments-differ @@ -255,6 +305,38 @@ type(self).__name__, self.__undefined__, dict.__repr__(self)) +class DefaultFactoryMunch(defaultdict, Munch): + """ A Munch that calls a user-specified function to generate values for + missing keys like collections.defaultdict. + + >>> b = DefaultFactoryMunch(list, {'hello': 'world!'}) + >>> b.hello + 'world!' + >>> b.foo + [] + >>> b.bar.append('hello') + >>> b.bar + ['hello'] + """ + + def __init__(self, default_factory, *args, **kwargs): + # pylint: disable=useless-super-delegation + super(DefaultFactoryMunch, self).__init__(default_factory, *args, **kwargs) + + @classmethod + def fromDict(cls, d, default_factory): + # pylint: disable=arguments-differ + return munchify(d, factory=lambda d_: cls(default_factory, d_)) + + def copy(self): + return type(self).fromDict(self, default_factory=self.default_factory) + + def __repr__(self): + factory = self.default_factory.__name__ + return '{0}({1}, {2})'.format( + type(self).__name__, factory, dict.__repr__(self)) + + # While we could convert abstract types like Mapping or Iterable, I think # munchify is more likely to "do what you mean" if it is conservative about # casting (ex: isinstance(str,Iterable) == True ). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.2.0/munch.egg-info/PKG-INFO new/munch-2.3.2/munch.egg-info/PKG-INFO --- old/munch-2.2.0/munch.egg-info/PKG-INFO 2017-07-27 12:07:57.000000000 +0200 +++ new/munch-2.3.2/munch.egg-info/PKG-INFO 2018-05-06 08:41:31.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: munch -Version: 2.2.0 +Version: 2.3.2 Summary: A dot-accessible dictionary (a la JavaScript objects). Home-page: http://github.com/Infinidat/munch Author: Rotem Yaari @@ -13,12 +13,9 @@ Classifier: Intended Audience :: Developers Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.5 -Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 Classifier: Topic :: Software Development Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Utilities diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.2.0/munch.egg-info/SOURCES.txt new/munch-2.3.2/munch.egg-info/SOURCES.txt --- old/munch-2.2.0/munch.egg-info/SOURCES.txt 2017-07-27 12:07:57.000000000 +0200 +++ new/munch-2.3.2/munch.egg-info/SOURCES.txt 2018-05-06 08:41:31.000000000 +0200 @@ -1,6 +1,7 @@ LICENSE.txt MANIFEST.in README.md +setup.cfg setup.py munch/__init__.py munch/python3_compat.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.2.0/setup.cfg new/munch-2.3.2/setup.cfg --- old/munch-2.2.0/setup.cfg 2017-07-27 12:07:57.000000000 +0200 +++ new/munch-2.3.2/setup.cfg 2018-05-06 08:41:31.000000000 +0200 @@ -1,5 +1,7 @@ +[bdist_wheel] +universal = 1 + [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.2.0/setup.py new/munch-2.3.2/setup.py --- old/munch-2.2.0/setup.py 2017-07-27 12:07:25.000000000 +0200 +++ new/munch-2.3.2/setup.py 2018-05-06 08:40:56.000000000 +0200 @@ -31,12 +31,9 @@ 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'Programming Language :: Python', - "Programming Language :: Python :: 2.5", - "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3.3", - "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", 'Topic :: Software Development', 'Topic :: Software Development :: Libraries', 'Topic :: Utilities',
