Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-munch for openSUSE:Factory checked in at 2023-06-11 19:52:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-munch (Old) and /work/SRC/openSUSE:Factory/.python-munch.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-munch" Sun Jun 11 19:52:33 2023 rev:5 rq:1091747 version:3.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-munch/python-munch.changes 2023-04-22 22:00:48.961344003 +0200 +++ /work/SRC/openSUSE:Factory/.python-munch.new.15902/python-munch.changes 2023-06-11 19:52:35.482186833 +0200 @@ -1,0 +2,16 @@ +Thu Jun 8 14:12:23 UTC 2023 - [email protected] + +- version update to 3.0.0 + * Fix munchify for tuples of lists + * Require Python >=3.6 and upgrade syntax - thanks @EwoutH + * Update __init__.py to work with non standard version - thanks @mboisson + * Allow importing even when VERSION read fails - thanks @mdornseif and @dangillet + * Add imports to README + * replace pkg_resources with importlib.metadata - thanks @dhellmann + * Added RecursiveMunch object - thanks @GuillaumeRochette +- added patches + fix https://github.com/Infinidat/munch/issues/96 + + python-munch-no-six.patch +- test package + +------------------------------------------------------------------- Old: ---- munch-2.5.0.tar.gz New: ---- munch-3.0.0.tar.gz python-munch-no-six.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-munch.spec ++++++ --- /var/tmp/diff_new_pack.lGtcky/_old 2023-06-11 19:52:39.150208952 +0200 +++ /var/tmp/diff_new_pack.lGtcky/_new 2023-06-11 19:52:39.218209362 +0200 @@ -16,24 +16,24 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %{?sle15_python_module_pythons} Name: python-munch -Version: 2.5.0 +Version: 3.0.0 Release: 0 Summary: A dot-accessible dictionary License: MIT Group: Development/Languages/Python -URL: http://github.com/Infinidat/munch +URL: https://github.com/Infinidat/munch Source: https://files.pythonhosted.org/packages/source/m/munch/munch-%{version}.tar.gz +# https://github.com/Infinidat/munch/issues/96 +Patch0: python-munch-no-six.patch BuildRequires: %{python_module pbr} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-six BuildArch: noarch # SECTION test requirements -BuildRequires: %{python_module six} +BuildRequires: %{python_module pytest} # /SECTION %python_subpackages @@ -41,7 +41,7 @@ A dot-accessible dictionary (a la JavaScript objects). %prep -%setup -q -n munch-%{version} +%autosetup -p1 -n munch-%{version} %build %python_build @@ -50,9 +50,13 @@ %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +%pytest + %files %{python_files} %license LICENSE.txt %doc README.md -%{python_sitelib}/* +%{python_sitelib}/munch +%{python_sitelib}/munch-*.egg-info %changelog ++++++ munch-2.5.0.tar.gz -> munch-3.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/.github/workflows/ci.yml new/munch-3.0.0/.github/workflows/ci.yml --- old/munch-2.5.0/.github/workflows/ci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/munch-3.0.0/.github/workflows/ci.yml 2023-05-14 14:28:32.000000000 +0200 @@ -0,0 +1,54 @@ +name: Build and Test +on: + push: + branches: [ master, develop ] + pull_request: + branches: [ master, develop ] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"] + include: + - os: macos-latest + python-version: "3.10" + - os: windows-latest + python-version: "3.10" + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Upgrade pip + run: python -m pip install --upgrade pip + - name: Upgrade build tools and pytest + run: pip install --upgrade build wheel setuptools pytest + - name: Install dependencies + run: pip install ".[testing,yaml]" + - name: Build distributions + run: python -m build + - name: Test with Pytest + run: pytest + + pylint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Upgrade pip + run: python -m pip install --upgrade pip + - name: Upgrade build tools and pytest + run: pip install --upgrade build wheel setuptools + - name: Install dependencies + run: pip install ".[testing,yaml]" + - name: Lint + run: pylint munch setup.py tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/.github/workflows/dependabot.yml new/munch-3.0.0/.github/workflows/dependabot.yml --- old/munch-2.5.0/.github/workflows/dependabot.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/munch-3.0.0/.github/workflows/dependabot.yml 2023-05-14 14:28:32.000000000 +0200 @@ -0,0 +1,8 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/.github/workflows/python-publish.yml new/munch-3.0.0/.github/workflows/python-publish.yml --- old/munch-2.5.0/.github/workflows/python-publish.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/munch-3.0.0/.github/workflows/python-publish.yml 2023-05-14 14:28:32.000000000 +0200 @@ -0,0 +1,39 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: python -m build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/.pylintrc new/munch-3.0.0/.pylintrc --- old/munch-2.5.0/.pylintrc 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/.pylintrc 2023-05-14 14:28:32.000000000 +0200 @@ -1,5 +1,5 @@ [MESSAGES CONTROL] -disable=invalid-name,missing-docstring,too-few-public-methods,no-else-return +disable=invalid-name,missing-docstring,too-few-public-methods,no-else-return,unnecessary-comprehension,bad-option-value [REPORTS] reports=no diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/AUTHORS new/munch-3.0.0/AUTHORS --- old/munch-2.5.0/AUTHORS 2019-10-30 10:56:05.000000000 +0100 +++ new/munch-3.0.0/AUTHORS 2023-05-14 14:28:55.000000000 +0200 @@ -1,19 +1 @@ -Alex Fraser <[email protected]> -Alex Wilson <[email protected]> -Alex Wilson <[email protected]> -Arnon Yaari <[email protected]> -Ayala Shachar <[email protected]> -Ben Artin <[email protected]> -Bob Haddleton <[email protected]> -Eric Kuecks <[email protected]> -Guy Rozendorn <[email protected]> -Jacob Magnusson <[email protected]> -Jamshed Vesuna <[email protected]> -Jose Vargas <[email protected]> -Laszlo Marai <[email protected]> -Maor Marcus <[email protected]> -Oded Badt <[email protected]> -Paul Belanger <[email protected]> -Rotem Yaari <[email protected]> -Rotem Yaari <[email protected]> -femtotrader <[email protected]> +David Sternlicht <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/CHANGELOG.md new/munch-3.0.0/CHANGELOG.md --- old/munch-2.5.0/CHANGELOG.md 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/CHANGELOG.md 2023-05-14 14:28:32.000000000 +0200 @@ -4,6 +4,17 @@ Next Version ------------ +3.0.0 (2023-05-14) +------------------ + +* Fix munchify for tuples of lists +* Require Python >=3.6 and upgrade syntax - thanks @EwoutH +* Update __init__.py to work with non standard version - thanks @mboisson +* Allow importing even when VERSION read fails - thanks @mdornseif and @dangillet +* Add imports to README +* replace pkg_resources with importlib.metadata - thanks @dhellmann +* Added RecursiveMunch object - thanks @GuillaumeRochette + 2.5.0 (2019-10-30) ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/ChangeLog new/munch-3.0.0/ChangeLog --- old/munch-2.5.0/ChangeLog 2019-10-30 10:56:05.000000000 +0100 +++ new/munch-3.0.0/ChangeLog 2023-05-14 14:28:55.000000000 +0200 @@ -1,156 +1,7 @@ CHANGES ======= -2.5.0 +3.0.0 ----- -* Update CHANGELOG.md -* Support fromJSON classmethod for all Munch subclasses -* Fix DefaultMunch/DefaultFactoryMunch return value for get method (fixes #53) -* Support fromYAML classmethod for all Munch subclasses (fixes #34) -* Clean CHANGELOG.md - -2.4.0 ------ - -* Update CHANGELOG.md -* Add Changelog -* Remove usage of deprecated API: Add default loader to yaml loads (#51) -* Improve README.md and add unittest for its code blocks -* Skip yaml tests if PyYAML is not installed -* Improve Pylint validations -* Switch to PBR (#49) -* Switch to PBR -* Add constructors to all PyYAML loaders (fixes #44) (#47) -* Add constructors to all PyYAML loaders (fixes #44) -* Fix/namedtuple handling (#46) -* Fixed namedtuple handling in unmunchify (just in case someone tries to unmunchify a Munch created with munchify which may contain a namedtuple, from now on) -* Fixed namedtuple handling in munchify. Namedtuples are kept in the generated hierarchy, but their children are also converted -* Fixed test case -* Created test case for bug: namedtuples cause an exception -* Clearer variable names -* Can simplify passing of seen and factory if helpers are nested -* Better naming and scoping of helper functions -* Handle tuple-tuple cycles correctly -* Test list-list and tuple-tuple cycles -* Test more dict-dict cycles -* Test for identity in cycle tests -* Correctly munchify and unmunchify structures with object cycles -* Ignore VSCode workspace files -* Fixed typo caught by ImportError -* Added newline at end of file -* Generalize munchify and unmunchify for Mapping instances -* Overwrite built-in methods for safer subclassing -* Fix typo in travis-ci yaml file - -2.3.2 ------ - -* Bump version -* Limit travis deployment conditions -* Build python wheels - -2.3.1 ------ - -* Ignore flycheck files -* Bump version -* Avoid running yaml tests when in no-deps environment -* Ignore pytest cache -* Drop the dot in pytest invocation -* Use flat dicts in \_\_getstate\_\_ (closes #30) - -2.3.0 ------ - -* Bump version -* Fix lint in init -* Remove default from constructor and fromDict. Also add a test for repr reversibility and update test names -* Make DefaultFactoryMunch which lets users provide a factory to generate missing values -* Rebasing with upstream -* Drop support for 2.6, 3.3, 3.4 -* AutoMunch for automatically converting dicts to Munches -* \_\_setattr\_\_ will now munchify() any provided dict -* Clear and update dict -* Implement the pickling interface -* Drop support for Python 2.6, 3.3, 3.4 -* Add \_\_dict\_\_ property that calls toDict() - -2.2.0 ------ - -* Bump version -* Fix for Python 2.6: str.format must field names -* Changed \_\_repr\_\_ to use str.format instead of x % y -* Made DefaultMunch documentation a little clearer -* Ignoring pylint warning about fromDict having different arguments -* Fix for pylint in Python 3.5: method arguments differ -* Added DefaultMunch, which returns a special value for missing attributes - -2.1.1 ------ - -* v2.1.1 -* Fix python 3 compatibility to work with IronPython (fix #13) -* Deploy from Travis -* Add python 3.6 -* Add pylintrc -* Fix lint tox config - -2.1.0 ------ - -* v2.1.0 -* fix flake8 -* implement copy method. Fixes issue #10 -* Fix \_\_contains\_\_ returning True for Munchâs default attributes Includes changes from #6, as I couldn't test without it -* Fix tests and use standard py.test tests instead Doctests were failing on all python versions. This PR fixes that - -2.0.4 ------ - -* v2.0.4 -* Modernize tests -* Fixed some edge cases -* Fixed tests -* Fixed String representation of objects with keys that have spaces -* Stop taking long rst description from README markdown - -2.0.3 ------ - -* v2.0.3 -* Move to new travis infrastructure -* Fix doctests -* Ignore .cache -* Python 3.5 support -* Update setup.py -* Fix badges -* Update README.md -* Test against Python 3.4 -* Add support for running dir() on munches -* Move to use py.test - -2.0.2 ------ - -* Fix packaging manifest - -2.0.1 ------ - -* v2.0.1 -* Rename to Munch -* Fix Py3 compatibility check -* Fix Readme -* Fix Readme -* Fix tox, reorganize tests and add Makefile -* Drop Python 3.2 support, add 3.3 -* renaming infi.bunch to chunk -* Update gitignore - -2.0.0 ------ - -* Forking bunch --> infi.bunch -* Python 3 Compatibility Fixes +* Update changelog for 3.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/PKG-INFO new/munch-3.0.0/PKG-INFO --- old/munch-2.5.0/PKG-INFO 2019-10-30 10:56:06.000000000 +0100 +++ new/munch-3.0.0/PKG-INFO 2023-05-14 14:28:55.100046000 +0200 @@ -1,187 +1,193 @@ Metadata-Version: 2.1 Name: munch -Version: 2.5.0 +Version: 3.0.0 Summary: A dot-accessible dictionary (a la JavaScript objects) Home-page: https://github.com/Infinidat/munch Author: Rotem Yaari Author-email: [email protected] License: MIT -Description: [](https://travis-ci.org/Infinidat/munch) - [](https://pypi.python.org/pypi/munch/) - [](https://pypi.python.org/pypi/munch/) - [](https://pypi.python.org/pypi/munch/) - - munch - ========== - - munch is a fork of David Schoonover's **Bunch** package, providing similar functionality. 99% of the work was done by him, and the fork was made mainly for lack of responsiveness for fixes and maintenance on the original code. - - Munch is a dictionary that supports attribute-style access, a la JavaScript: - - ```python - - >>> b = Munch() - >>> b.hello = 'world' - >>> b.hello - 'world' - >>> b['hello'] += "!" - >>> b.hello - 'world!' - >>> b.foo = Munch(lol=True) - >>> b.foo.lol - True - >>> b.foo is b['foo'] - True - - ``` - - - Dictionary Methods - ------------------ - - A Munch is a subclass of ``dict``; it supports all the methods a ``dict`` does: - - ```python - - >>> list(b.keys()) - ['hello', 'foo'] - - ``` - - Including ``update()``: - - ```python - - >>> b.update({ 'ponies': 'are pretty!' }, hello=42) - >>> print(repr(b)) - Munch({'hello': 42, 'foo': Munch({'lol': True}), 'ponies': 'are pretty!'}) - - ``` - - As well as iteration: - - ```python - - >>> [ (k,b[k]) for k in b ] - [('hello', 42), ('foo', Munch({'lol': True})), ('ponies', 'are pretty!')] - - ``` - - And "splats": - - ```python - - >>> "The {knights} who say {ni}!".format(**Munch(knights='lolcats', ni='can haz')) - 'The lolcats who say can haz!' - - ``` - - - Serialization - ------------- - - Munches happily and transparently serialize to JSON and YAML. - - ```python - - >>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!') - >>> import json - >>> json.dumps(b) - '{"foo": {"lol": true}, "hello": 42, "ponies": "are pretty!"}' - - ``` - - If JSON support is present (``json`` or ``simplejson``), ``Munch`` will have a ``toJSON()`` method which returns the object as a JSON string. - - If you have [PyYAML](http://pyyaml.org/wiki/PyYAML) installed, Munch attempts to register itself with the various YAML Representers so that Munches can be transparently dumped and loaded. - - ```python - - >>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!') - >>> import yaml - >>> yaml.dump(b) - '!munch.Munch\nfoo: !munch.Munch\n lol: true\nhello: 42\nponies: are pretty!\n' - >>> yaml.safe_dump(b) - 'foo:\n lol: true\nhello: 42\nponies: are pretty!\n' - - ``` - - In addition, Munch instances will have a ``toYAML()`` method that returns the YAML string using ``yaml.safe_dump()``. This method also replaces ``__str__`` if present, as I find it far more readable. You can revert back to Python's default use of ``__repr__`` with a simple assignment: ``Munch.__str__ = Munch.__repr__``. The Munch class will also have a static method ``Munch.fromYAML()``, which loads a Munch out of a YAML string. - - Finally, Munch converts easily and recursively to (``unmunchify()``, ``Munch.toDict()``) and from (``munchify()``, ``Munch.fromDict()``) a normal ``dict``, making it easy to cleanly serialize them in other formats. - - - Default Values - -------------- - - ``DefaultMunch`` instances return a specific default value when an attribute is missing from the collection. Like ``collections.defaultdict``, the first argument is the value to use for missing keys: - - ```python - - >>> undefined = object() - >>> b = DefaultMunch(undefined, {'hello': 'world!'}) - >>> b.hello - 'world!' - >>> b.foo is undefined - True - - ``` - - ``DefaultMunch.fromDict()`` also takes the ``default`` argument: - - ```python - - >>> undefined = object() - >>> b = DefaultMunch.fromDict({'recursively': {'nested': 'value'}}, undefined) - >>> b.recursively.nested == 'value' - True - >>> b.recursively.foo is undefined - True - - ``` - - Or you can use ``DefaultFactoryMunch`` to specify a factory for generating missing attributes. The first argument is the factory: - - ```python - - >>> 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``, ``DefaultFactoryMunch``, ``munchify`` and ``unmunchify``. - * Ample Tests. Just run ``pip install tox && tox`` from the project root. - - Feedback - -------- - - Open a ticket / fork the project on [GitHub](http://github.com/Infinidat/munch). - - Keywords: munch,dict,mapping,container,collection -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Utilities Classifier: License :: OSI Approved :: MIT License +Requires-Python: >=3.6 Description-Content-Type: text/markdown Provides-Extra: testing Provides-Extra: yaml +License-File: LICENSE.txt + +[](https://travis-ci.org/Infinidat/munch) +[](https://pypi.python.org/pypi/munch/) +[](https://pypi.python.org/pypi/munch/) +[](https://pypi.python.org/pypi/munch/) + +munch +========== + +munch is a fork of David Schoonover's **Bunch** package, providing similar functionality. 99% of the work was done by him, and the fork was made mainly for lack of responsiveness for fixes and maintenance on the original code. + +Munch is a dictionary that supports attribute-style access, a la JavaScript: + +```python + +>>> from munch import Munch +>>> b = Munch() +>>> b.hello = 'world' +>>> b.hello +'world' +>>> b['hello'] += "!" +>>> b.hello +'world!' +>>> b.foo = Munch(lol=True) +>>> b.foo.lol +True +>>> b.foo is b['foo'] +True + +``` + + +Dictionary Methods +------------------ + +A Munch is a subclass of ``dict``; it supports all the methods a ``dict`` does: + +```python + +>>> list(b.keys()) +['hello', 'foo'] + +``` + +Including ``update()``: + +```python + +>>> b.update({ 'ponies': 'are pretty!' }, hello=42) +>>> print(repr(b)) +Munch({'hello': 42, 'foo': Munch({'lol': True}), 'ponies': 'are pretty!'}) + +``` + +As well as iteration: + +```python + +>>> [ (k,b[k]) for k in b ] +[('hello', 42), ('foo', Munch({'lol': True})), ('ponies', 'are pretty!')] + +``` + +And "splats": + +```python + +>>> "The {knights} who say {ni}!".format(**Munch(knights='lolcats', ni='can haz')) +'The lolcats who say can haz!' + +``` + + +Serialization +------------- + +Munches happily and transparently serialize to JSON and YAML. + +```python + +>>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!') +>>> import json +>>> json.dumps(b) +'{"foo": {"lol": true}, "hello": 42, "ponies": "are pretty!"}' + +``` + +If JSON support is present (``json`` or ``simplejson``), ``Munch`` will have a ``toJSON()`` method which returns the object as a JSON string. + +If you have [PyYAML](http://pyyaml.org/wiki/PyYAML) installed, Munch attempts to register itself with the various YAML Representers so that Munches can be transparently dumped and loaded. + +```python + +>>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!') +>>> import yaml +>>> yaml.dump(b) +'!munch.Munch\nfoo: !munch.Munch\n lol: true\nhello: 42\nponies: are pretty!\n' +>>> yaml.safe_dump(b) +'foo:\n lol: true\nhello: 42\nponies: are pretty!\n' + +``` + +In addition, Munch instances will have a ``toYAML()`` method that returns the YAML string using ``yaml.safe_dump()``. This method also replaces ``__str__`` if present, as I find it far more readable. You can revert back to Python's default use of ``__repr__`` with a simple assignment: ``Munch.__str__ = Munch.__repr__``. The Munch class will also have a static method ``Munch.fromYAML()``, which loads a Munch out of a YAML string. + +Finally, Munch converts easily and recursively to (``unmunchify()``, ``Munch.toDict()``) and from (``munchify()``, ``Munch.fromDict()``) a normal ``dict``, making it easy to cleanly serialize them in other formats. + + +Default Values +-------------- + +``DefaultMunch`` instances return a specific default value when an attribute is missing from the collection. Like ``collections.defaultdict``, the first argument is the value to use for missing keys: + +```python + +>>> from munch import DefaultMunch +>>> undefined = object() +>>> b = DefaultMunch(undefined, {'hello': 'world!'}) +>>> b.hello +'world!' +>>> b.foo is undefined +True + +``` + +``DefaultMunch.fromDict()`` also takes the ``default`` argument: + +```python + +>>> undefined = object() +>>> b = DefaultMunch.fromDict({'recursively': {'nested': 'value'}}, undefined) +>>> b.recursively.nested == 'value' +True +>>> b.recursively.foo is undefined +True + +``` + +Or you can use ``DefaultFactoryMunch`` to specify a factory for generating missing attributes. The first argument is the factory: + +```python + +>>> from munch import DefaultFactoryMunch +>>> 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``, ``DefaultFactoryMunch``, ``munchify`` and ``unmunchify``. +* Ample Tests. Just run ``pip install tox && tox`` from the project root. + +Feedback +-------- + +Open a ticket / fork the project on [GitHub](http://github.com/Infinidat/munch). + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/README.md new/munch-3.0.0/README.md --- old/munch-2.5.0/README.md 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/README.md 2023-05-14 14:28:32.000000000 +0200 @@ -12,6 +12,7 @@ ```python +>>> from munch import Munch >>> b = Munch() >>> b.hello = 'world' >>> b.hello @@ -110,6 +111,7 @@ ```python +>>> from munch import DefaultMunch >>> undefined = object() >>> b = DefaultMunch(undefined, {'hello': 'world!'}) >>> b.hello @@ -136,6 +138,7 @@ ```python +>>> from munch import DefaultFactoryMunch >>> b = DefaultFactoryMunch(list, {'hello': 'world!'}) >>> b.hello 'world!' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/munch/__init__.py new/munch-3.0.0/munch/__init__.py --- old/munch-2.5.0/munch/__init__.py 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/munch/__init__.py 2023-05-14 14:28:32.000000000 +0200 @@ -21,14 +21,27 @@ converted via Munch.to/fromDict(). """ -import pkg_resources - from .python3_compat import iterkeys, iteritems, Mapping, u -__version__ = pkg_resources.get_distribution('munch').version -VERSION = tuple(map(int, __version__.split('.')[:3])) +try: + # For python 3.8 and later + import importlib.metadata as importlib_metadata +except ImportError: + # For everyone else + import importlib_metadata +try: + __version__ = importlib_metadata.version(__name__) +except importlib_metadata.PackageNotFoundError: + # package is not installed + __version__ = "0.0.0" + + +try: + VERSION = tuple(map(int, __version__.split('+')[0].split('.')[:3])) +except ValueError: + VERSION = (0, 0, 0) -__all__ = ('Munch', 'munchify', 'DefaultMunch', 'DefaultFactoryMunch', 'unmunchify') +__all__ = ('Munch', 'munchify', 'DefaultMunch', 'DefaultFactoryMunch', 'RecursiveMunch', 'unmunchify') @@ -189,7 +202,7 @@ (*) Invertible so long as collection contents are each repr-invertible. """ - return '{0}({1})'.format(self.__class__.__name__, dict.__repr__(self)) + return f'{self.__class__.__name__}({dict.__repr__(self)})' def __dir__(self): return list(iterkeys(self)) @@ -258,7 +271,7 @@ """ if isinstance(v, Mapping) and not isinstance(v, (AutoMunch, Munch)): v = munchify(v, AutoMunch) - super(AutoMunch, self).__setattr__(k, v) + super().__setattr__(k, v) class DefaultMunch(Munch): @@ -277,13 +290,13 @@ args = args[1:] else: default = None - super(DefaultMunch, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.__default__ = default def __getattr__(self, k): """ Gets key if it exists, otherwise returns the default value.""" try: - return super(DefaultMunch, self).__getattr__(k) + return super().__getattr__(k) except AttributeError: return self.__default__ @@ -291,12 +304,12 @@ if k == '__default__': object.__setattr__(self, k, v) else: - super(DefaultMunch, self).__setattr__(k, v) + super().__setattr__(k, v) def __getitem__(self, k): """ Gets key if it exists, otherwise returns the default value.""" try: - return super(DefaultMunch, self).__getitem__(k) + return super().__getitem__(k) except KeyError: return self.__default__ @@ -326,8 +339,7 @@ return type(self).fromDict(self, default=self.__default__) def __repr__(self): - return '{0}({1!r}, {2})'.format( - type(self).__name__, self.__undefined__, dict.__repr__(self)) + return f'{type(self).__name__}({self.__undefined__!r}, {dict.__repr__(self)})' class DefaultFactoryMunch(Munch): @@ -345,7 +357,7 @@ """ def __init__(self, default_factory, *args, **kwargs): - super(DefaultFactoryMunch, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.default_factory = default_factory @classmethod @@ -358,20 +370,48 @@ def __repr__(self): factory = self.default_factory.__name__ - return '{0}({1}, {2})'.format( - type(self).__name__, factory, dict.__repr__(self)) + return f'{type(self).__name__}({factory}, {dict.__repr__(self)})' def __setattr__(self, k, v): if k == 'default_factory': object.__setattr__(self, k, v) else: - super(DefaultFactoryMunch, self).__setattr__(k, v) + super().__setattr__(k, v) def __missing__(self, k): self[k] = self.default_factory() return self[k] +class RecursiveMunch(DefaultFactoryMunch): + """A Munch that calls an instance of itself to generate values for + missing keys. + + >>> b = RecursiveMunch({'hello': 'world!'}) + >>> b.hello + 'world!' + >>> b.foo + RecursiveMunch(RecursiveMunch, {}) + >>> b.bar.okay = 'hello' + >>> b.bar + RecursiveMunch(RecursiveMunch, {'okay': 'hello'}) + >>> b + RecursiveMunch(RecursiveMunch, {'hello': 'world!', 'foo': RecursiveMunch(RecursiveMunch, {}), + 'bar': RecursiveMunch(RecursiveMunch, {'okay': 'hello'})}) + """ + + def __init__(self, *args, **kwargs): + super().__init__(RecursiveMunch, *args, **kwargs) + + @classmethod + def fromDict(cls, d): + # pylint: disable=arguments-differ + return munchify(d, factory=cls) + + def copy(self): + return type(self).fromDict(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 ). @@ -402,16 +442,21 @@ seen = dict() def munchify_cycles(obj): + partial, already_seen = pre_munchify_cycles(obj) + if already_seen: + return partial + return post_munchify(partial, obj) + + def pre_munchify_cycles(obj): # If we've already begun munchifying obj, just return the already-created munchified obj try: - return seen[id(obj)] + return seen[id(obj)], True except KeyError: pass # Otherwise, first partly munchify obj (but without descending into any lists or dicts) and save that seen[id(obj)] = partial = pre_munchify(obj) - # Then finish munchifying lists and dicts inside obj (reusing munchified obj if cycles are encountered) - return post_munchify(partial, obj) + return partial, False def pre_munchify(obj): # Here we return a skeleton of munchified obj, which is enough to save for later (in case @@ -422,7 +467,7 @@ return type(obj)() elif isinstance(obj, tuple): type_factory = getattr(obj, "_make", type(obj)) - return type_factory(munchify_cycles(item) for item in obj) + return type_factory(pre_munchify_cycles(item)[0] for item in obj) else: return obj diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/munch/python3_compat.py new/munch-3.0.0/munch/python3_compat.py --- old/munch-2.5.0/munch/python3_compat.py 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/munch/python3_compat.py 2023-05-14 14:28:32.000000000 +0200 @@ -3,4 +3,4 @@ from collections.abc import Mapping # pylint: disable=unused-import except ImportError: # Legacy Python - from collections import Mapping # pylint: disable=unused-import + from collections.abc import Mapping # pylint: disable=unused-import diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/munch.egg-info/PKG-INFO new/munch-3.0.0/munch.egg-info/PKG-INFO --- old/munch-2.5.0/munch.egg-info/PKG-INFO 2019-10-30 10:56:05.000000000 +0100 +++ new/munch-3.0.0/munch.egg-info/PKG-INFO 2023-05-14 14:28:55.000000000 +0200 @@ -1,187 +1,193 @@ Metadata-Version: 2.1 Name: munch -Version: 2.5.0 +Version: 3.0.0 Summary: A dot-accessible dictionary (a la JavaScript objects) Home-page: https://github.com/Infinidat/munch Author: Rotem Yaari Author-email: [email protected] License: MIT -Description: [](https://travis-ci.org/Infinidat/munch) - [](https://pypi.python.org/pypi/munch/) - [](https://pypi.python.org/pypi/munch/) - [](https://pypi.python.org/pypi/munch/) - - munch - ========== - - munch is a fork of David Schoonover's **Bunch** package, providing similar functionality. 99% of the work was done by him, and the fork was made mainly for lack of responsiveness for fixes and maintenance on the original code. - - Munch is a dictionary that supports attribute-style access, a la JavaScript: - - ```python - - >>> b = Munch() - >>> b.hello = 'world' - >>> b.hello - 'world' - >>> b['hello'] += "!" - >>> b.hello - 'world!' - >>> b.foo = Munch(lol=True) - >>> b.foo.lol - True - >>> b.foo is b['foo'] - True - - ``` - - - Dictionary Methods - ------------------ - - A Munch is a subclass of ``dict``; it supports all the methods a ``dict`` does: - - ```python - - >>> list(b.keys()) - ['hello', 'foo'] - - ``` - - Including ``update()``: - - ```python - - >>> b.update({ 'ponies': 'are pretty!' }, hello=42) - >>> print(repr(b)) - Munch({'hello': 42, 'foo': Munch({'lol': True}), 'ponies': 'are pretty!'}) - - ``` - - As well as iteration: - - ```python - - >>> [ (k,b[k]) for k in b ] - [('hello', 42), ('foo', Munch({'lol': True})), ('ponies', 'are pretty!')] - - ``` - - And "splats": - - ```python - - >>> "The {knights} who say {ni}!".format(**Munch(knights='lolcats', ni='can haz')) - 'The lolcats who say can haz!' - - ``` - - - Serialization - ------------- - - Munches happily and transparently serialize to JSON and YAML. - - ```python - - >>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!') - >>> import json - >>> json.dumps(b) - '{"foo": {"lol": true}, "hello": 42, "ponies": "are pretty!"}' - - ``` - - If JSON support is present (``json`` or ``simplejson``), ``Munch`` will have a ``toJSON()`` method which returns the object as a JSON string. - - If you have [PyYAML](http://pyyaml.org/wiki/PyYAML) installed, Munch attempts to register itself with the various YAML Representers so that Munches can be transparently dumped and loaded. - - ```python - - >>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!') - >>> import yaml - >>> yaml.dump(b) - '!munch.Munch\nfoo: !munch.Munch\n lol: true\nhello: 42\nponies: are pretty!\n' - >>> yaml.safe_dump(b) - 'foo:\n lol: true\nhello: 42\nponies: are pretty!\n' - - ``` - - In addition, Munch instances will have a ``toYAML()`` method that returns the YAML string using ``yaml.safe_dump()``. This method also replaces ``__str__`` if present, as I find it far more readable. You can revert back to Python's default use of ``__repr__`` with a simple assignment: ``Munch.__str__ = Munch.__repr__``. The Munch class will also have a static method ``Munch.fromYAML()``, which loads a Munch out of a YAML string. - - Finally, Munch converts easily and recursively to (``unmunchify()``, ``Munch.toDict()``) and from (``munchify()``, ``Munch.fromDict()``) a normal ``dict``, making it easy to cleanly serialize them in other formats. - - - Default Values - -------------- - - ``DefaultMunch`` instances return a specific default value when an attribute is missing from the collection. Like ``collections.defaultdict``, the first argument is the value to use for missing keys: - - ```python - - >>> undefined = object() - >>> b = DefaultMunch(undefined, {'hello': 'world!'}) - >>> b.hello - 'world!' - >>> b.foo is undefined - True - - ``` - - ``DefaultMunch.fromDict()`` also takes the ``default`` argument: - - ```python - - >>> undefined = object() - >>> b = DefaultMunch.fromDict({'recursively': {'nested': 'value'}}, undefined) - >>> b.recursively.nested == 'value' - True - >>> b.recursively.foo is undefined - True - - ``` - - Or you can use ``DefaultFactoryMunch`` to specify a factory for generating missing attributes. The first argument is the factory: - - ```python - - >>> 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``, ``DefaultFactoryMunch``, ``munchify`` and ``unmunchify``. - * Ample Tests. Just run ``pip install tox && tox`` from the project root. - - Feedback - -------- - - Open a ticket / fork the project on [GitHub](http://github.com/Infinidat/munch). - - Keywords: munch,dict,mapping,container,collection -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Topic :: Software Development Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Utilities Classifier: License :: OSI Approved :: MIT License +Requires-Python: >=3.6 Description-Content-Type: text/markdown Provides-Extra: testing Provides-Extra: yaml +License-File: LICENSE.txt + +[](https://travis-ci.org/Infinidat/munch) +[](https://pypi.python.org/pypi/munch/) +[](https://pypi.python.org/pypi/munch/) +[](https://pypi.python.org/pypi/munch/) + +munch +========== + +munch is a fork of David Schoonover's **Bunch** package, providing similar functionality. 99% of the work was done by him, and the fork was made mainly for lack of responsiveness for fixes and maintenance on the original code. + +Munch is a dictionary that supports attribute-style access, a la JavaScript: + +```python + +>>> from munch import Munch +>>> b = Munch() +>>> b.hello = 'world' +>>> b.hello +'world' +>>> b['hello'] += "!" +>>> b.hello +'world!' +>>> b.foo = Munch(lol=True) +>>> b.foo.lol +True +>>> b.foo is b['foo'] +True + +``` + + +Dictionary Methods +------------------ + +A Munch is a subclass of ``dict``; it supports all the methods a ``dict`` does: + +```python + +>>> list(b.keys()) +['hello', 'foo'] + +``` + +Including ``update()``: + +```python + +>>> b.update({ 'ponies': 'are pretty!' }, hello=42) +>>> print(repr(b)) +Munch({'hello': 42, 'foo': Munch({'lol': True}), 'ponies': 'are pretty!'}) + +``` + +As well as iteration: + +```python + +>>> [ (k,b[k]) for k in b ] +[('hello', 42), ('foo', Munch({'lol': True})), ('ponies', 'are pretty!')] + +``` + +And "splats": + +```python + +>>> "The {knights} who say {ni}!".format(**Munch(knights='lolcats', ni='can haz')) +'The lolcats who say can haz!' + +``` + + +Serialization +------------- + +Munches happily and transparently serialize to JSON and YAML. + +```python + +>>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!') +>>> import json +>>> json.dumps(b) +'{"foo": {"lol": true}, "hello": 42, "ponies": "are pretty!"}' + +``` + +If JSON support is present (``json`` or ``simplejson``), ``Munch`` will have a ``toJSON()`` method which returns the object as a JSON string. + +If you have [PyYAML](http://pyyaml.org/wiki/PyYAML) installed, Munch attempts to register itself with the various YAML Representers so that Munches can be transparently dumped and loaded. + +```python + +>>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!') +>>> import yaml +>>> yaml.dump(b) +'!munch.Munch\nfoo: !munch.Munch\n lol: true\nhello: 42\nponies: are pretty!\n' +>>> yaml.safe_dump(b) +'foo:\n lol: true\nhello: 42\nponies: are pretty!\n' + +``` + +In addition, Munch instances will have a ``toYAML()`` method that returns the YAML string using ``yaml.safe_dump()``. This method also replaces ``__str__`` if present, as I find it far more readable. You can revert back to Python's default use of ``__repr__`` with a simple assignment: ``Munch.__str__ = Munch.__repr__``. The Munch class will also have a static method ``Munch.fromYAML()``, which loads a Munch out of a YAML string. + +Finally, Munch converts easily and recursively to (``unmunchify()``, ``Munch.toDict()``) and from (``munchify()``, ``Munch.fromDict()``) a normal ``dict``, making it easy to cleanly serialize them in other formats. + + +Default Values +-------------- + +``DefaultMunch`` instances return a specific default value when an attribute is missing from the collection. Like ``collections.defaultdict``, the first argument is the value to use for missing keys: + +```python + +>>> from munch import DefaultMunch +>>> undefined = object() +>>> b = DefaultMunch(undefined, {'hello': 'world!'}) +>>> b.hello +'world!' +>>> b.foo is undefined +True + +``` + +``DefaultMunch.fromDict()`` also takes the ``default`` argument: + +```python + +>>> undefined = object() +>>> b = DefaultMunch.fromDict({'recursively': {'nested': 'value'}}, undefined) +>>> b.recursively.nested == 'value' +True +>>> b.recursively.foo is undefined +True + +``` + +Or you can use ``DefaultFactoryMunch`` to specify a factory for generating missing attributes. The first argument is the factory: + +```python + +>>> from munch import DefaultFactoryMunch +>>> 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``, ``DefaultFactoryMunch``, ``munchify`` and ``unmunchify``. +* Ample Tests. Just run ``pip install tox && tox`` from the project root. + +Feedback +-------- + +Open a ticket / fork the project on [GitHub](http://github.com/Infinidat/munch). + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/munch.egg-info/SOURCES.txt new/munch-3.0.0/munch.egg-info/SOURCES.txt --- old/munch-2.5.0/munch.egg-info/SOURCES.txt 2019-10-30 10:56:06.000000000 +0100 +++ new/munch-3.0.0/munch.egg-info/SOURCES.txt 2023-05-14 14:28:55.000000000 +0200 @@ -12,6 +12,9 @@ setup.cfg setup.py tox.ini +.github/workflows/ci.yml +.github/workflows/dependabot.yml +.github/workflows/python-publish.yml munch/__init__.py munch/python3_compat.py munch.egg-info/PKG-INFO diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/munch.egg-info/pbr.json new/munch-3.0.0/munch.egg-info/pbr.json --- old/munch-2.5.0/munch.egg-info/pbr.json 2019-10-30 10:56:05.000000000 +0100 +++ new/munch-3.0.0/munch.egg-info/pbr.json 2023-05-14 14:28:55.000000000 +0200 @@ -1 +1 @@ -{"git_version": "292b8eb", "is_release": true} \ No newline at end of file +{"git_version": "edd1669", "is_release": false} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/munch.egg-info/requires.txt new/munch-3.0.0/munch.egg-info/requires.txt --- old/munch-2.5.0/munch.egg-info/requires.txt 2019-10-30 10:56:05.000000000 +0100 +++ new/munch-3.0.0/munch.egg-info/requires.txt 2023-05-14 14:28:55.000000000 +0200 @@ -1,16 +1,13 @@ six -[testing] -pytest -coverage - -[testing:python_version == "2.7"] -astroid~=1.5.3 -pylint~=1.7.2 +[:(python_version<'3.8')] +importlib_metadata>=1.7.0 -[testing:python_version >= "3.4"] +[testing] astroid>=2.0 pylint~=2.3.1 +pytest +coverage [yaml] PyYAML>=5.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/requirements.txt new/munch-3.0.0/requirements.txt --- old/munch-2.5.0/requirements.txt 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/requirements.txt 2023-05-14 14:28:32.000000000 +0200 @@ -1 +1,2 @@ six +importlib_metadata>=1.7.0;python_version<'3.8' # Apache-2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/setup.cfg new/munch-3.0.0/setup.cfg --- old/munch-2.5.0/setup.cfg 2019-10-30 10:56:06.000000000 +0100 +++ new/munch-3.0.0/setup.cfg 2023-05-14 14:28:55.100046000 +0200 @@ -5,17 +5,18 @@ Intended Audience :: Developers Operating System :: OS Independent Programming Language :: Python - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3.5 Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Topic :: Software Development Topic :: Software Development :: Libraries Topic :: Utilities License :: OSI Approved :: MIT License summary = A dot-accessible dictionary (a la JavaScript objects) -description-file = - README.md +description-file = README.md description-content-type = text/markdown license = MIT author = Rotem Yaari @@ -24,10 +25,8 @@ [extras] testing = - astroid~=1.5.3; python_version=='2.7' - astroid>=2.0; python_version >= '3.4' - pylint~=1.7.2; python_version=='2.7' - pylint~=2.3.1; python_version >= '3.4' + astroid>=2.0 + pylint~=2.3.1 pytest coverage yaml = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/setup.py new/munch-3.0.0/setup.py --- old/munch-2.5.0/setup.py 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/setup.py 2023-05-14 14:28:32.000000000 +0200 @@ -2,8 +2,9 @@ setup( - setup_requires=['pbr>=3.0', 'setuptools>=17.1'], + setup_requires=['pbr>=3.0', 'setuptools>=61'], pbr=True, long_description_content_type='text/markdown; charset=UTF-8', keywords=['munch', 'dict', 'mapping', 'container', 'collection'], + python_requires=">=3.6", ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/tests/conftest.py new/munch-3.0.0/tests/conftest.py --- old/munch-2.5.0/tests/conftest.py 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/tests/conftest.py 2023-05-14 14:28:32.000000000 +0200 @@ -5,14 +5,15 @@ @pytest.fixture(name='yaml') def yaml_module(): try: - import yaml + import yaml # pylint: disable=import-outside-toplevel return yaml except ImportError: pass pytest.skip("Module 'PyYAML' is required") [email protected](params=[munch.Munch, munch.AutoMunch, munch.DefaultMunch, munch.DefaultFactoryMunch]) [email protected](params=[munch.Munch, munch.AutoMunch, munch.DefaultMunch, munch.DefaultFactoryMunch, + munch.RecursiveMunch]) def munch_obj(request): cls = request.param args = tuple() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/tests/test_munch.py new/munch-3.0.0/tests/test_munch.py --- old/munch-2.5.0/tests/test_munch.py 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/tests/test_munch.py 2023-05-14 14:28:32.000000000 +0200 @@ -520,7 +520,7 @@ def test_class(cls, *args): class CustomMunch(cls): def __setitem__(self, k, v): - super(CustomMunch, self).__setitem__(k, [v] * 2) + super().__setitem__(k, [v] * 2) custom_munch = CustomMunch(*args, a='foo') assert custom_munch.a == ['foo', 'foo'] regular_dict = {} @@ -547,5 +547,27 @@ assert custom_munch.copy() == Munch(a=42, b=42) [email protected]("yaml") def test_get_default_value(munch_obj): assert munch_obj.get("fake_key", "default_value") == "default_value" + assert isinstance(munch_obj.toJSON(), str) + assert isinstance(munch_obj.toYAML(), str) + munch_obj.copy() + data = munch_obj.toDict() + munch_cls = type(munch_obj) + kwargs = {} if munch_cls != DefaultFactoryMunch else {"default_factory": munch_obj.default_factory} + munch_cls.fromDict(data, **kwargs) + + +def test_munchify_tuple_list(): + data = ([{'A': 'B'}],) + actual = munchify(data) + expected = ([Munch(A='B')],) + assert actual == expected + + +def test_munchify_tuple_list_more_elements(): + data = (1, 2, [{'A': 'B'}]) + actual = munchify(data) + expected = (1, 2, [Munch({'A': 'B'})]) + assert actual == expected diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/munch-2.5.0/tests/test_readme.py new/munch-3.0.0/tests/test_readme.py --- old/munch-2.5.0/tests/test_readme.py 2019-10-30 10:55:33.000000000 +0100 +++ new/munch-3.0.0/tests/test_readme.py 2023-05-14 14:28:32.000000000 +0200 @@ -1,26 +1,16 @@ -from __future__ import print_function - import doctest import os -import sys import pytest -import munch - _HERE = os.path.abspath(os.path.dirname(__file__)) _README_PATH = os.path.join(_HERE, '..', 'README.md') assert os.path.exists(_README_PATH) [email protected](sys.version_info[:2] < (3, 6), reason="Requires Python version >= 3.6") @pytest.mark.usefixtures("yaml") def test_readme(): globs = { - 'print_function': print_function, - 'munch': munch, - 'Munch': munch.Munch, - 'DefaultMunch': munch.DefaultMunch, - 'DefaultFactoryMunch': munch.DefaultFactoryMunch, + 'print_function': print } result = doctest.testfile(_README_PATH, module_relative=False, globs=globs) assert not result.failed ++++++ python-munch-no-six.patch ++++++ Index: munch-3.0.0/munch/__init__.py =================================================================== --- munch-3.0.0.orig/munch/__init__.py +++ munch-3.0.0/munch/__init__.py @@ -21,8 +21,6 @@ converted via Munch.to/fromDict(). """ -from .python3_compat import iterkeys, iteritems, Mapping, u - try: # For python 3.8 and later import importlib.metadata as importlib_metadata @@ -35,6 +33,7 @@ except importlib_metadata.PackageNotFoun # package is not installed __version__ = "0.0.0" +from collections.abc import Mapping try: VERSION = tuple(map(int, __version__.split('+')[0].split('.')[:3])) @@ -205,7 +204,7 @@ class Munch(dict): return f'{self.__class__.__name__}({dict.__repr__(self)})' def __dir__(self): - return list(iterkeys(self)) + return list(self.keys()) def __getstate__(self): """ Implement a serializable interface used for pickling. @@ -244,7 +243,7 @@ class Munch(dict): Override built-in method to call custom __setitem__ method that may be defined in subclasses. """ - for k, v in iteritems(dict(*args, **kwargs)): + for k, v in dict(*args, **kwargs).items(): self[k] = v def get(self, k, d=None): @@ -475,7 +474,7 @@ def munchify(x, factory=Munch): # Here we finish munchifying the parts of obj that were deferred by pre_munchify because they # might be involved in a cycle if isinstance(obj, Mapping): - partial.update((k, munchify_cycles(obj[k])) for k in iterkeys(obj)) + partial.update((k, munchify_cycles(obj[k])) for k in obj.keys()) elif isinstance(obj, list): partial.extend(munchify_cycles(item) for item in obj) elif isinstance(obj, tuple): @@ -537,7 +536,7 @@ def unmunchify(x): # Here we finish unmunchifying the parts of obj that were deferred by pre_unmunchify because they # might be involved in a cycle if isinstance(obj, Mapping): - partial.update((k, unmunchify_cycles(obj[k])) for k in iterkeys(obj)) + partial.update((k, unmunchify_cycles(obj[k])) for k in obj.keys()) elif isinstance(obj, list): partial.extend(unmunchify_cycles(v) for v in obj) elif isinstance(obj, tuple): @@ -626,15 +625,15 @@ try: >>> yaml.dump(b, default_flow_style=True) '!munch.Munch {foo: [bar, !munch.Munch {lol: true}], hello: 42}\\n' """ - return dumper.represent_mapping(u('!munch.Munch'), data) + return dumper.represent_mapping('!munch.Munch', data) for loader_name in ("BaseLoader", "FullLoader", "SafeLoader", "Loader", "UnsafeLoader", "DangerLoader"): LoaderCls = getattr(yaml, loader_name, None) if LoaderCls is None: # This code supports both PyYAML 4.x and 5.x versions continue - yaml.add_constructor(u('!munch'), from_yaml, Loader=LoaderCls) - yaml.add_constructor(u('!munch.Munch'), from_yaml, Loader=LoaderCls) + yaml.add_constructor('!munch', from_yaml, Loader=LoaderCls) + yaml.add_constructor('!munch.Munch', from_yaml, Loader=LoaderCls) SafeRepresenter.add_representer(Munch, to_yaml_safe) SafeRepresenter.add_multi_representer(Munch, to_yaml_safe) Index: munch-3.0.0/munch/python3_compat.py =================================================================== --- munch-3.0.0.orig/munch/python3_compat.py +++ /dev/null @@ -1,6 +0,0 @@ -from six import u, iteritems, iterkeys # pylint: disable=unused-import -try: - from collections.abc import Mapping # pylint: disable=unused-import -except ImportError: - # Legacy Python - from collections.abc import Mapping # pylint: disable=unused-import Index: munch-3.0.0/munch.egg-info/requires.txt =================================================================== --- munch-3.0.0.orig/munch.egg-info/requires.txt +++ munch-3.0.0/munch.egg-info/requires.txt @@ -1,5 +1,3 @@ -six - [:(python_version<'3.8')] importlib_metadata>=1.7.0 Index: munch-3.0.0/requirements.txt =================================================================== --- munch-3.0.0.orig/requirements.txt +++ munch-3.0.0/requirements.txt @@ -1,2 +1 @@ -six importlib_metadata>=1.7.0;python_version<'3.8' # Apache-2.0
