Hello community,
here is the log from the commit of package python-flatdict for openSUSE:Factory
checked in at 2020-02-28 15:21:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-flatdict (Old)
and /work/SRC/openSUSE:Factory/.python-flatdict.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-flatdict"
Fri Feb 28 15:21:31 2020 rev:2 rq:780088 version:4.0.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-flatdict/python-flatdict.changes
2019-11-27 13:50:36.752506022 +0100
+++
/work/SRC/openSUSE:Factory/.python-flatdict.new.26092/python-flatdict.changes
2020-02-28 15:21:33.629919899 +0100
@@ -1,0 +2,9 @@
+Fri Feb 28 05:33:22 UTC 2020 - Steve Kowalik <[email protected]>
+
+- Update to version 4.0.1:
+ * Gracefully fail to install if setuptools is too old
+ * FIXED deprecation warning from Python 3.9
+ * FIXED keep order of received dict and it's nested objects
+ * Drops Python 2 support and Python 3.4
+
+-------------------------------------------------------------------
Old:
----
flatdict-3.4.0.tar.gz
New:
----
flatdict-4.0.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-flatdict.spec ++++++
--- /var/tmp/diff_new_pack.hvqZ7t/_old 2020-02-28 15:21:34.041920738 +0100
+++ /var/tmp/diff_new_pack.hvqZ7t/_new 2020-02-28 15:21:34.045920746 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-flatdict
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,8 +17,9 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%define skip_python2 1
Name: python-flatdict
-Version: 3.4.0
+Version: 4.0.1
Release: 0
Summary: Python module for interacting with nested dicts
License: BSD-3-Clause
++++++ flatdict-3.4.0.tar.gz -> flatdict-4.0.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/.github/workflows/deploy.yaml
new/flatdict-4.0.1/.github/workflows/deploy.yaml
--- old/flatdict-3.4.0/.github/workflows/deploy.yaml 1970-01-01
01:00:00.000000000 +0100
+++ new/flatdict-4.0.1/.github/workflows/deploy.yaml 2020-02-13
20:15:00.000000000 +0100
@@ -0,0 +1,20 @@
+name: Deployment
+on:
+ push:
+ branches-ignore: ["*"]
+ tags: ["*"]
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ if: github.event_name == 'push' && startsWith(github.event.ref,
'refs/tags')
+ container: python:3.8-alpine
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v1
+ - name: Build package
+ run: python3 setup.py sdist
+ - name: Publish package
+ uses: pypa/gh-action-pypi-publish@master
+ with:
+ user: __token__
+ password: ${{ secrets.PYPI_PASSWORD }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/.github/workflows/testing.yaml
new/flatdict-4.0.1/.github/workflows/testing.yaml
--- old/flatdict-3.4.0/.github/workflows/testing.yaml 1970-01-01
01:00:00.000000000 +0100
+++ new/flatdict-4.0.1/.github/workflows/testing.yaml 2020-02-13
20:15:00.000000000 +0100
@@ -0,0 +1,36 @@
+name: Testing
+on:
+ push:
+ branches: ["*"]
+ paths-ignore:
+ - 'docs/**'
+ - 'setup.*'
+ - '*.md'
+ - '*.rst'
+ tags-ignore: ["*"]
+jobs:
+ test:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python: [3.5, 3.6, 3.7, 3.8, 3.9-rc]
+ container:
+ image: python:${{ matrix.python }}-alpine
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v1
+
+ - name: Bootstrap the test environment
+ run: pip install -r requires/testing.txt && mkdir -p build
+
+ - name: Run flake8 tests
+ run: flake8
+
+ - name: Run unittests
+ run: coverage run && coverage report && coverage xml
+
+ - name: Upload Coverage
+ uses: codecov/[email protected]
+ with:
+ token: ${{secrets.CODECOV_TOKEN}}
+ file: build/coverage.xml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/.travis.yml
new/flatdict-4.0.1/.travis.yml
--- old/flatdict-3.4.0/.travis.yml 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/.travis.yml 1970-01-01 01:00:00.000000000 +0100
@@ -1,53 +0,0 @@
-language: python
-dist: xenial
-env:
- global:
- - PATH=$HOME/.local/bin:$PATH
- - AWS_DEFAULT_REGION=us-east-1
- - secure:
"sitNFpdiQMbxHJIXkxcUfpSbAIdl9+bFYZcP2nQgwA3CShwRp1bAq2kWUsrzFjPhs+yxX5O+VVokRR0qsLJwmoH0AggWdYKhpTu7iGLoypCggnHh6I0Kt6Vepn6EjjkgkCzg/N+9gmZ1ZgtZ1NRDNdidEbyaWNZ1SlGkCNd0bys="
- - secure:
"rKQwYdFMnU/MSWDlqMWuE44Zg/3uHDkay2K0y1dPjGxaQ1OE7AL+6VabbMoQ3kV4kBkFqaVn4yd4XeGvzkoeMz97tTWRPgztpztC77O+aqSPvYPkMU+iZQCpzIEekPAo7e/XEnZsxWgo9Io6zFbJkdg4PhXISycx05cpZbTJkK8="
-
-stages:
-- test
-- coverage
-- name: deploy
- if: tag IS present
-
-install:
-- python setup.py develop
-- pip install -r test-requirements.txt
-script: ci/test.sh
-after_success:
-- ci/upload-coverage.sh
-
-jobs:
- include:
- - python: "2.7"
- - python: "3.4"
- - python: "3.5"
- - python: "3.6"
- - python: "3.7"
- - python: pypy
- - python: pypy3
- - stage: coverage
- if: repo = gmr/flatdict
- python: "3.7"
- services: []
- script: ci/combine-coverage.sh
- - stage: deploy
- if: repo = gmr/flatdict
- python: "3.7"
- services: []
- install: true
- before_script: []
- script: true
- after_success: []
- deploy:
- provider: pypi
- user: crad
- distributions: sdist bdist_wheel
- on:
- all_branches: true
- tags: true
- password:
- secure:
"s1oAkXrQ3V533S250UJ5Ycop+XOyMZdM5kn/pBmMe5SFU0RCdp3RK0/Sj9o4z4+Tn7AkPyoBw6zneftdmykClJKGNfFLyGpkpCPscEHztEDrd1fCTd55qphAOkWhdx3x17T3cjXvcvu9810y6ekgAoDx1Tw+Qi6AJ2VL+sCZzmI="
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/CHANGELOG.md
new/flatdict-4.0.1/CHANGELOG.md
--- old/flatdict-3.4.0/CHANGELOG.md 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/CHANGELOG.md 2020-02-13 20:15:00.000000000 +0100
@@ -1,5 +1,15 @@
# Changelog
+## 4.0.1 (2020-02-13)
+
+- Gracefully fail to install if setuptools is too old
+
+## 4.0.0 (2020-02-12)
+
+- FIXED deprecation warning from Python 3.9 (#40
[nugend](https://github.com/nugend))
+- FIXED keep order of received dict and it's nested objects (#38
[wsantos](https://github.com/wsantos))
+- Drops Python 2 support and Python 3.4
+
## 3.4.0 (2019-07-24)
- FIXED sort order with regard to a nested list of dictionaries (#33
[wsantos](https://github.com/wsantos))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/CONTRIBUTING.md
new/flatdict-4.0.1/CONTRIBUTING.md
--- old/flatdict-3.4.0/CONTRIBUTING.md 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/CONTRIBUTING.md 2020-02-13 20:15:00.000000000 +0100
@@ -4,44 +4,28 @@
Use of virtual environments will allow for isolated installation of testing
requirements:
-###Python 2
-
```bash
-virtualenv -p python2.7 env27
-source env/bin/activate
-pip install -r test-requirements
-```
-
-###Python 3
-
-```bash
-python3 -m venv env
-source env/bin/activate
-pip install -r test-requirements
+./bootstrap
```
## Running Tests
-###Python 2
-
-```bash
-source env27/bin/activate
-./ci/test.sh
-```
-
-###Python 3
-
```bash
source env/bin/activate
-./ci/test.sh
+flake8
+coverage run && coverage report
```
+`coverage xml` && `coverage html` are configured to output reports in the
`build` directory.
+
## Test Coverage
To contribute to `flatdict`, please make sure that any new features or changes
to existing functionality **include test coverage**.
*Pull requests that add or change code without coverage have a much lower
chance of being accepted.*
+**Pull requests that fail flake8 tests as configured will not be accepted.**
+
## Code Formatting
Please format your code using [yapf](http://pypi.python.org/pypi/yapf)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/LICENSE new/flatdict-4.0.1/LICENSE
--- old/flatdict-3.4.0/LICENSE 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/LICENSE 2020-02-13 20:15:00.000000000 +0100
@@ -1,4 +1,4 @@
-Copyright (c) 2013-2018 Gavin M. Roy
+Copyright (c) 2013-2020 Gavin M. Roy
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/README.rst
new/flatdict-4.0.1/README.rst
--- old/flatdict-3.4.0/README.rst 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/README.rst 2020-02-13 20:15:00.000000000 +0100
@@ -3,56 +3,62 @@
|Version| |Status| |Coverage| |License|
-``FlatDict`` is a dict object that allows for single level, delimited key/value
-pair mapping of nested dictionaries. You can interact with FlatDict like a
normal
-dictionary and access child dicts as you normally would or with the composite
-key.
+``FlatDict`` and ``FlatterDict`` are a dict classes that allows for single
level,
+delimited key/value pair mapping of nested dictionaries. You can interact with
+``FlatDict`` and ``FlatterDict`` like a normal dictionary and access child
+dictionaries as you normally would or with the composite key.
-Examples
---------
+*For example:*
.. code-block:: python
- foo = {'foo': {'bar': 'baz', 'qux': 'corge'}}
+ value = flatdict.FlatDict({'foo': {'bar': 'baz', 'qux': 'corge'}})
-*is represented as:*
+*would be the same as:*
.. code-block:: python
- {'foo:bar': 'baz',
- 'foo:qux': 'corge'}
+ value == {'foo:bar': 'baz', 'foo:qux': 'corge'}
-*And can still be accessed as:*
+*values can be accessed as:*
.. code-block:: python
- foo['foo']['bar']
-
-*and*
+ print(foo['foo:bar'])
-.. code-block:: python
+ # or
- foo['foo:bar']
+ print(foo['foo']['bar'])
-Additionally, lists and tuples are also converted into dicts using enumerate().
+Additionally, lists and tuples are also converted into dicts using
``enumerate()``,
+using the ``FlatterDict`` class.
*For example:*
.. code-block:: python
- d = {'list': ['a', 'b', 'c',]}
+ value = flatdict.FlatterDict({'list': ['a', 'b', 'c']})
-*Will be flattened as follows:*
+*will be the same as:*
.. code-block:: python
- flat = {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}
+ value == {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}
API
---
Documentation is available at https://flatdict.readthedocs.io
+Versioning
+----------
+This package attempts to use semantic versioning. API changes are indicated
+by the major version, non-breaking improvements by the minor, and bug fixes
+in the revision.
+
+It is recommended that you pin your targets to greater or equal to the current
+version and less than the next major version.
+
Installation
------------
@@ -60,51 +66,17 @@
$ pip install flatdict
-Example Use
------------
-
-.. code-block:: python
-
- import pprint
-
- import flatdict
-
- values = {'foo': {'bar': {'baz': 0,
- 'qux': 1,
- 'corge': 2},
- 'grault': {'baz': 3,
- 'qux': 4,
- 'corge': 5}},
- 'garply': {'foo': 0, 'bar': 1, 'baz': 2, 'qux': {'corge': 3}}}
-
- flat = flatdict.FlatDict(values)
-
- print(flat['foo:bar:baz'])
-
- flat['test:value:key'] = 10
-
- del flat['test']
-
- for key in flat:
- print(key)
-
- for value in flat.itervalues():
- print(value)
-
- pprint.pprint(flat.as_dict())
-
- pprint.pprint(dict(flat))
-
- print(flat == flat.as_dict())
+Note that as of 4.0, setuptools 39.2 or higher is required for installation.
.. |Version| image:: https://img.shields.io/pypi/v/flatdict.svg?
:target: https://pypi.python.org/pypi/flatdict
-.. |Status| image:: https://img.shields.io/travis/gmr/flatdict.svg?
- :target: https://travis-ci.org/gmr/flatdict
+.. |Status| image:: https://github.com/gmr/flatdict/workflows/Testing/badge.svg
+ :target: https://github.com/gmr/flatdict/actions
+ :alt: Build Status
.. |Coverage| image:: https://img.shields.io/codecov/c/github/gmr/flatdict.svg?
:target: https://codecov.io/github/gmr/flatdict?branch=master
.. |License| image:: https://img.shields.io/pypi/l/flatdict.svg?
- :target: https://flatdict.readthedocs.org
\ No newline at end of file
+ :target: https://flatdict.readthedocs.org
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/bootstrap new/flatdict-4.0.1/bootstrap
--- old/flatdict-3.4.0/bootstrap 1970-01-01 01:00:00.000000000 +0100
+++ new/flatdict-4.0.1/bootstrap 2020-02-13 20:15:00.000000000 +0100
@@ -0,0 +1,6 @@
+#!/usr/bin/env sh
+python3 -m venv env
+source env/bin/activate
+pip install --upgrade pip
+pip install -r requires/testing.txt
+mkdir -p build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/ci/combine-coverage.sh
new/flatdict-4.0.1/ci/combine-coverage.sh
--- old/flatdict-3.4.0/ci/combine-coverage.sh 2019-07-24 08:41:21.000000000
+0200
+++ new/flatdict-4.0.1/ci/combine-coverage.sh 1970-01-01 01:00:00.000000000
+0100
@@ -1,16 +0,0 @@
-#!/usr/bin/env sh
-set -e
-if [ -z "${AWS_ACCESS_KEY_ID}" ]
-then
- echo "AWS_ACCESS_KEY_ID is not set, exiting"
- exit 0
-fi
-pip install awscli coverage codecov
-mkdir coverage
-aws s3 cp --recursive
s3://com-gavinroy-travis/flatdict/${TRAVIS_BUILD_NUMBER}/ coverage
-cd coverage
-coverage combine
-cd ..
-mv coverage/.coverage .
-coverage report
-codecov
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/ci/test.sh
new/flatdict-4.0.1/ci/test.sh
--- old/flatdict-3.4.0/ci/test.sh 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/ci/test.sh 1970-01-01 01:00:00.000000000 +0100
@@ -1,5 +0,0 @@
-#!/usr/bin/env sh
-set -e
-nosetests -x
-echo "Running Flake8 tests"
-flake8
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/ci/upload-coverage.sh
new/flatdict-4.0.1/ci/upload-coverage.sh
--- old/flatdict-3.4.0/ci/upload-coverage.sh 2019-07-24 08:41:21.000000000
+0200
+++ new/flatdict-4.0.1/ci/upload-coverage.sh 1970-01-01 01:00:00.000000000
+0100
@@ -1,9 +0,0 @@
-#!/usr/bin/env sh
-set -e
-pip install awscli
-if [ -z "${AWS_ACCESS_KEY_ID}" ]
-then
- echo "AWS_ACCESS_KEY_ID is not set, exiting"
- exit 0
-fi
-aws s3 cp .coverage
"s3://com-gavinroy-travis/flatdict/${TRAVIS_BUILD_NUMBER}/.coverage.${TRAVIS_PYTHON_VERSION}"
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/docs/index.rst
new/flatdict-4.0.1/docs/index.rst
--- old/flatdict-3.4.0/docs/index.rst 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/docs/index.rst 2020-02-13 20:15:00.000000000 +0100
@@ -1,13 +1,9 @@
-.. FlatDict documentation master file, created by
- You can adapt this file completely to your liking, but it should at least
- contain the root `toctree` directive.
-
FlatDict
========
|Version| |Status| |Coverage| |License|
-**FlatDict** is a Python module for interacting with nested dicts as a single
-level dict with delimited keys. FlatDict supports Python 2.7+ and 3.4+.
+``flatdict`` is a Python module for interacting with nested dicts as a single
+level dict with delimited keys. ``flatdict`` supports Python 3.5+.
Jump to :ref:`installation`, :ref:`example`, or :ref:`docs`.
@@ -15,40 +11,38 @@
.. code-block:: python
- foo = {'foo': {'bar': 'baz', 'qux': 'corge'}}
+ value = flatdict.FlatDict({'foo': {'bar': 'baz', 'qux': 'corge'}})
-*is represented as:*
+*can be accessed as:*
.. code-block:: python
- {'foo:bar': 'baz',
- 'foo:qux': 'corge'}
+ value == {'foo:bar': 'baz', 'foo:qux': 'corge'}
-*And can still be accessed as:*
+*values can be accessed as:*
.. code-block:: python
- foo['foo']['bar']
-
-*and*
+ print(foo['foo:bar'])
-.. code-block:: python
+ # or
- foo['foo:bar']
+ print(foo['foo']['bar'])
-Additionally, lists and tuples are also converted into dicts using enumerate().
+Additionally, lists and tuples are also converted into dicts using enumerate(),
+using the :py:class:`~flatdict.FlatterDict` class.
*For example:*
.. code-block:: python
- d = {'list': ['a', 'b', 'c',]}
+ value = flatdict.FlatterDict({'list': ['a', 'b', 'c']})
-*Will be flattened as follows:*
+*will be flattened as follows:*
.. code-block:: python
- flat = {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}
+ value == {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}
.. _installation:
@@ -59,26 +53,37 @@
$ pip install flatdict
+Versioning
+----------
+
+This package attempts to use semantic versioning. API changes are indicated
+by the major version, non-breaking improvements by the minor, and bug fixes
+in the revision.
+
+It is recommended that you pin your targets to greater or equal to the current
+version and less than the next major version.
+
.. _example:
Example Use
-----------
+:py:class:`flatdict.FlatDict`
+
.. code-block:: python
import pprint
import flatdict
- values = {'foo': {'bar': {'baz': 0,
- 'qux': 1,
- 'corge': 2},
- 'grault': {'baz': 3,
- 'qux': 4,
- 'corge': 5}},
- 'garply': {'foo': 0, 'bar': 1, 'baz': 2, 'qux': {'corge': 3}}}
-
- flat = flatdict.FlatDict(values)
+ flat = flatdict.FlatDict(
+ {'foo': {'bar': {'baz': 0,
+ 'qux': 1,
+ 'corge': 2},
+ 'grault': {'baz': 3,
+ 'qux': 4,
+ 'corge': 5}},
+ 'garply': {'foo': 0, 'bar': 1, 'baz': 2, 'qux': {'corge': 3}}})
print(flat['foo:bar:baz'])
@@ -98,10 +103,20 @@
print(flat == flat.as_dict())
+:py:class:`flatdict.FlatterDict`
+
+.. code-block:: python
+
+ import flatdict
+
+ value = flatdict.FlatterDict({'list': ['a', 'b', 'c']})
+ for key, value in value.items():
+ print(key, value)
+
.. _docs:
-Class Documentation
--------------------
+API Documentation
+-----------------
.. automodule:: flatdict
:members:
@@ -111,11 +126,12 @@
.. |Version| image:: https://img.shields.io/pypi/v/flatdict.svg?
:target: https://pypi.python.org/pypi/flatdict
-.. |Status| image:: https://img.shields.io/travis/gmr/flatdict.svg?
- :target: https://travis-ci.org/gmr/flatdict
+.. |Status| image:: https://github.com/gmr/flatdict/workflows/Testing/badge.svg
+ :target: https://github.com/gmr/flatdict/actions
+ :alt: Build Status
.. |Coverage| image:: https://img.shields.io/codecov/c/github/gmr/flatdict.svg?
:target: https://codecov.io/github/gmr/flatdict?branch=master
.. |License| image:: https://img.shields.io/pypi/l/flatdict.svg?
- :target: https://flatdict.readthedocs.org
\ No newline at end of file
+ :target: https://flatdict.readthedocs.org
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/flatdict.py
new/flatdict-4.0.1/flatdict.py
--- old/flatdict-3.4.0/flatdict.py 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/flatdict.py 2020-02-13 20:15:00.000000000 +0100
@@ -2,20 +2,18 @@
key/value pair mapping of nested dictionaries.
"""
-import collections
+try:
+ from collections.abc import MutableMapping
+except ImportError: # pragma: nocover
+ from collections import MutableMapping
+import sys
-__version__ = '3.4.0'
+__version__ = '4.0.1'
NO_DEFAULT = object()
-# Python 2/3 string compat
-try:
- basestring
-except NameError:
- basestring = str
-
-class FlatDict(collections.MutableMapping):
+class FlatDict(MutableMapping):
""":class:`~flatdict.FlatDict` is a dictionary object that allows for
single level, delimited key/value pair mapping of nested dictionaries.
The default delimiter value is ``:`` but can be changed in the constructor
@@ -70,10 +68,10 @@
"""
if isinstance(other, dict):
- return sorted(self.as_dict()) == sorted(other)
+ return self.as_dict() == other
elif not isinstance(other, self.__class__):
raise TypeError
- return sorted(self.as_dict()) == sorted(other.as_dict())
+ return self.as_dict() == other.as_dict()
def __ne__(self, other):
"""Check for inequality against the other value
@@ -95,7 +93,8 @@
"""
values = self._values
- for part in key.split(self._delimiter):
+ key = [key] if isinstance(key, int) else key.split(self._delimiter)
+ for part in key:
values = values[part]
return values
@@ -284,20 +283,14 @@
for key, value in self._values.items():
if isinstance(value, (FlatDict, dict)):
- nested = [self._delimiter.join([key, k]) for k in value.keys()]
+ nested = [
+ self._delimiter.join([str(key), str(k)])
+ for k in value.keys()]
keys += nested if nested else [key]
else:
keys.append(key)
- return [
- self._delimiter.join(map(str, item))
- for item in sorted(
- [
- int(s_key) if s_key.isdigit() else s_key
- for s_key in key.split(self._delimiter)
- ] for key in keys
- )
- ]
+ return keys
def pop(self, key, default=NO_DEFAULT):
"""If key is in the flat dictionary, remove it and return its value,
@@ -377,7 +370,7 @@
:rtype: bool
"""
- return isinstance(key, basestring) and self._delimiter in key
+ return isinstance(key, str) and self._delimiter in key
class FlatterDict(FlatDict):
@@ -476,8 +469,8 @@
keys = subset.keys()
if any(self._has_delimiter(k) for k in keys):
out = []
- split_keys = [k.split(self._delimiter)[0] for k in keys]
- for k in sorted(set(split_keys), key=lambda x: int(x)):
+ split_keys = {k.split(self._delimiter)[0] for k in keys}
+ for k in sorted(split_keys, key=lambda x: int(x)):
if subset[k].original_type == tuple:
out.append(tuple(self._child_as_list(pk, k)))
elif subset[k].original_type == list:
@@ -487,4 +480,10 @@
elif subset[k].original_type == dict:
out.append(subset[k].as_dict())
return out
- return [subset[k] for k in sorted(keys, key=lambda x: int(x))]
+
+ # Python prior 3.6 does not guarantee insertion order, remove it after
+ # EOL python 3.5 - 2020-09-13
+ if sys.version_info[0:2] < (3, 6): # pragma: nocover
+ return [subset[k] for k in sorted(keys, key=lambda x: int(x))]
+ else:
+ return [subset[k] for k in keys]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/requires/testing.txt
new/flatdict-4.0.1/requires/testing.txt
--- old/flatdict-3.4.0/requires/testing.txt 1970-01-01 01:00:00.000000000
+0100
+++ new/flatdict-4.0.1/requires/testing.txt 2020-02-13 20:15:00.000000000
+0100
@@ -0,0 +1,9 @@
+codecov
+coverage
+flake8
+flake8-comprehensions
+flake8-deprecated
+flake8-import-order
+flake8-quotes
+flake8-rst-docstrings
+flake8-tuple
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/setup.cfg new/flatdict-4.0.1/setup.cfg
--- old/flatdict-3.4.0/setup.cfg 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/setup.cfg 2020-02-13 20:15:00.000000000 +0100
@@ -14,13 +14,12 @@
License :: OSI Approved :: BSD License
Operating System :: POSIX
Programming Language :: Python
- Programming Language :: Python :: 2
- Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
- Programming Language :: Python :: 3.4
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 :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
@@ -34,15 +33,21 @@
[flake8]
application-import-names = flatdict
-exclude = ci, docs, env, env27
+exclude = ci, docs, env
ignore = RST304
import-order-style = google
-[nosetests]
-cover-branches = 1
-cover-html = true
-cover-html-dir = coverage
-cover-package = flatdict
-logging-level = DEBUG
-with-coverage = 1
-verbosity = 2
+[coverage:run]
+branch = True
+command_line = -m unittest discover
+
+[coverage:report]
+show_missing = True
+omit =
+ tests.py
+
+[coverage:html]
+directory = build/coverage
+
+[coverage:xml]
+output = build/coverage.xml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/setup.py new/flatdict-4.0.1/setup.py
--- old/flatdict-3.4.0/setup.py 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/setup.py 2020-02-13 20:15:00.000000000 +0100
@@ -1,3 +1,7 @@
+import pkg_resources
import setuptools
+setuptools_version = pkg_resources.parse_version(setuptools.__version__)
+if setuptools_version < pkg_resources.parse_version('39.2'):
+ raise SystemExit('setuptools 39.2 or greater required for installation')
setuptools.setup()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/test-requirements.txt
new/flatdict-4.0.1/test-requirements.txt
--- old/flatdict-3.4.0/test-requirements.txt 2019-07-24 08:41:21.000000000
+0200
+++ new/flatdict-4.0.1/test-requirements.txt 1970-01-01 01:00:00.000000000
+0100
@@ -1,11 +0,0 @@
-codecov
-coverage
-flake8
-flake8-comprehensions
-flake8-deprecated
-flake8-import-order
-flake8-quotes
-flake8-rst-docstrings
-flake8-tuple
-mock
-nose
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/flatdict-3.4.0/tests.py new/flatdict-4.0.1/tests.py
--- old/flatdict-3.4.0/tests.py 2019-07-24 08:41:21.000000000 +0200
+++ new/flatdict-4.0.1/tests.py 2020-02-13 20:15:00.000000000 +0100
@@ -4,7 +4,6 @@
"""
import pickle
import random
-import sys
import unittest
import uuid
@@ -39,13 +38,13 @@
'waldo:wanda': 7
}
- KEYS = sorted([
+ KEYS = [
'foo:bar:baz', 'foo:bar:qux', 'foo:bar:corge', 'foo:grault:baz',
'foo:grault:qux', 'foo:grault:corge', 'foo:list', 'foo:empty_list',
'foo:set', 'foo:empty_set', 'foo:tuple', 'foo:empty_tuple',
'garply:foo', 'garply:bar', 'garply:baz', 'garply:qux:corge', 'fred',
- 'thud', 'xyzzy', 'waldo:fred', 'waldo:wanda'
- ])
+ 'xyzzy', 'thud', 'waldo:fred', 'waldo:wanda'
+ ]
VALUES = {
'foo': {
@@ -150,8 +149,7 @@
self.assertDictEqual(self.value.as_dict(), self.AS_DICT)
def test_cast_to_dict(self):
- value = dict(self.value)
- self.assertDictEqual(value, self.FLAT_EXPECTATION)
+ self.assertDictEqual(dict(self.value), self.FLAT_EXPECTATION)
def test_casting_items_to_dict(self):
self.assertEqual(dict(self.value.items()), self.FLAT_EXPECTATION)
@@ -182,7 +180,8 @@
def test_str_value(self):
val = self.TEST_CLASS({'foo': 1, 'baz': {'qux': 'corgie'}})
- self.assertEqual("{'baz:qux': 'corgie', 'foo': 1}", str(val))
+ self.assertIn("'foo': 1", str(val))
+ self.assertIn("'baz:qux': 'corgie'", str(val))
def test_incorrect_assignment_raises(self):
value = self.TEST_CLASS({'foo': ['bar'], 'qux': 1})
@@ -226,15 +225,15 @@
def test_iter_items(self):
items = [(k, v) for k, v in self.value.iteritems()]
- self.assertEqual(self.value.items(), items)
+ self.assertListEqual(self.value.items(), items)
def test_iterkeys(self):
- keys = [k for k in self.value.iterkeys()]
- self.assertEqual(keys, self.KEYS)
+ keys = sorted(self.value.iterkeys())
+ self.assertListEqual(keys, sorted(self.KEYS))
def test_itervalues(self):
- values = [v for v in self.value.itervalues()]
- self.assertEqual(values, self.value.values())
+ values = list(self.value.itervalues())
+ self.assertListEqual(values, self.value.values())
def test_pop(self):
self.assertEqual(1, self.value.pop('foo:bar:qux'))
@@ -269,10 +268,12 @@
def test_set_delimiter(self):
self.value.set_delimiter('-')
- self.assertEqual([k.replace(':', '-') for k in self.KEYS],
- self.value.keys())
- self.assertEqual([self.value[k.replace(':', '-')] for k in self.KEYS],
- self.value.values())
+ self.assertListEqual(
+ sorted(k.replace(':', '-') for k in self.KEYS),
+ sorted(self.value.keys()))
+ self.assertListEqual(
+ sorted(str(self.value[k.replace(':', '-')]) for k in self.KEYS),
+ sorted(str(v) for v in self.value.values()))
def test_update(self):
expectation = self.TEST_CLASS(self.value.as_dict())
@@ -297,12 +298,6 @@
pickled = pickle.dumps(self.value)
self.assertEqual(pickle.loads(pickled), self.value)
- @unittest.skipIf(sys.version_info.major > 2, 'python2 unicode test')
- def test_python2_unicode_support(self):
- flat = self.TEST_CLASS()
- flat[u'key1:key2'] = u'value1'
- self.assertEqual(flat.as_dict(), {'key1': {'key2': 'value1'}})
-
def test_empty_dict_as_value(self):
expectation = {'foo': {'bar': {}}}
flat = self.TEST_CLASS(expectation)
@@ -365,22 +360,15 @@
}
KEYS = [
- 'double_nest:0:0',
- 'double_nest:0:1',
- 'double_nest:1:0',
- 'double_nest:1:1',
- 'double_nest:2:0',
- 'double_nest:2:1',
- 'foo:abc:def',
'foo:bar:baz',
+ 'foo:bar:qux',
'foo:bar:corge',
'foo:bar:list:0',
'foo:bar:list:1',
'foo:bar:list:2',
- 'foo:bar:qux',
'foo:grault:baz',
- 'foo:grault:corge',
'foo:grault:qux',
+ 'foo:grault:corge',
'foo:list:0',
'foo:list:1',
'foo:list:2',
@@ -399,19 +387,26 @@
'foo:tuple:0',
'foo:tuple:1',
'foo:tuple:2',
- 'fred',
+ 'foo:abc:def',
+ 'garply:foo',
'garply:bar',
'garply:baz',
- 'garply:foo',
'garply:qux:corge',
+ 'fred',
+ 'xyzzy',
+ 'thud',
+ 'waldo:fred',
+ 'waldo:wanda',
'neighbors:0:left',
'neighbors:0:right',
'neighbors:1:left',
'neighbors:1:right',
- 'thud',
- 'waldo:fred',
- 'waldo:wanda',
- 'xyzzy',
+ 'double_nest:0:0',
+ 'double_nest:0:1',
+ 'double_nest:1:0',
+ 'double_nest:1:1',
+ 'double_nest:2:0',
+ 'double_nest:2:1',
]
VALUES = {
@@ -442,16 +437,11 @@
'corge': 3
}
},
- 'fred':
- 4,
- 'xyzzy':
- 'plugh',
- 'thud':
- 5,
- 'waldo:fred':
- 6,
- 'waldo:wanda':
- 7,
+ 'fred': 4,
+ 'xyzzy': 'plugh',
+ 'thud': 5,
+ 'waldo:fred': 6,
+ 'waldo:wanda': 7,
'neighbors': [{
'left': 'john',
'right': 'michelle'