Hello community,
here is the log from the commit of package python-pyrsistent for
openSUSE:Factory checked in at 2020-10-29 09:46:04
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pyrsistent (Old)
and /work/SRC/openSUSE:Factory/.python-pyrsistent.new.3463 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pyrsistent"
Thu Oct 29 09:46:04 2020 rev:8 rq:838241 version:0.17.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pyrsistent/python-pyrsistent.changes
2020-07-21 15:41:00.007574804 +0200
+++
/work/SRC/openSUSE:Factory/.python-pyrsistent.new.3463/python-pyrsistent.changes
2020-10-29 09:46:09.348046743 +0100
@@ -1,0 +2,13 @@
+Mon Sep 28 11:11:31 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 0.17.3:
+ * Fix #208, release v0.17.3 with proper meta data requiring Python >= 3.5.
+ * Add "python_requires >= 2.7" to setup.py in preparation for Python 2.7
incompatible updates
+ * Same as 0.17.1 released with more recent version of setuptools to get
proper meta data for in place.
+ * Restrict package to Python >= 3.5 to not break unpinned Python 2
dependencies. Thanks @vphilippon
+ * Remove Python 2 support code. This includes dropping some compatibility
code and the dependency on
+ six. Thanks @djailla for this.
+ * Fix #200, python 3 exception chaining. This is a minor backwards
incompatibility, hence stepping
+ to 0.17.0. Thanks @cool-RR for this!
+
+-------------------------------------------------------------------
Old:
----
pyrsistent-0.16.0.tar.gz
New:
----
pyrsistent-0.17.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pyrsistent.spec ++++++
--- /var/tmp/diff_new_pack.Vfff1L/_old 2020-10-29 09:46:10.032047389 +0100
+++ /var/tmp/diff_new_pack.Vfff1L/_new 2020-10-29 09:46:10.036047392 +0100
@@ -17,8 +17,9 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%global skip_python2 1
Name: python-pyrsistent
-Version: 0.16.0
+Version: 0.17.3
Release: 0
Summary: Persistent, Functional, Immutable data structures
License: MIT
++++++ pyrsistent-0.16.0.tar.gz -> pyrsistent-0.17.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/CHANGES.txt
new/pyrsistent-0.17.3/CHANGES.txt
--- old/pyrsistent-0.16.0/CHANGES.txt 2020-03-24 20:45:19.000000000 +0100
+++ new/pyrsistent-0.17.3/CHANGES.txt 2020-09-13 09:04:14.000000000 +0200
@@ -1,5 +1,25 @@
Revision history
----------------
+0.17.3, 2020-09-13
+ * Fix #208, release v0.17.3 with proper meta data requiring Python >= 3.5.
+
+0.16.1, 2020-09-13
+ * Add "python_requires >= 2.7" to setup.py in preparation for Python 2.7
incompatible updates
+ in 0.17.
+
+0.17.2 (yanked awaiting proper fix for Python 3 req), 2020-09-09
+ * Same as 0.17.1 released with more recent version of setuptools to get
proper meta data for in place.
+
+0.17.1 (yanked for proper meta data), 2020-09-09
+ * Restrict package to Python >= 3.5 to not break unpinned Python 2
dependencies. Thanks @vphilippon
+ for this!
+
+0.17.0 (yanked for Python 2 compatibility), 2020-09-08
+ * Remove Python 2 support code. This includes dropping some compatibility
code and the dependency on
+ six. Thanks @djailla for this.
+ * Fix #200, python 3 exception chaining. This is a minor backwards
incompatibility, hence stepping
+ to 0.17.0. Thanks @cool-RR for this!
+
0.16.0, 2020-03-24
* No major updates but Python 2 support no longer guaranteed.
* Fix #192, 'ignore_extra' for 'pvector_field'. Thanks @ss18 for this!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/PKG-INFO
new/pyrsistent-0.17.3/PKG-INFO
--- old/pyrsistent-0.16.0/PKG-INFO 2020-03-24 20:46:32.000000000 +0100
+++ new/pyrsistent-0.17.3/PKG-INFO 2020-09-13 09:04:48.000000000 +0200
@@ -1,6 +1,6 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
Name: pyrsistent
-Version: 0.16.0
+Version: 0.17.3
Summary: Persistent/Functional/Immutable data structures
Home-page: http://github.com/tobgu/pyrsistent/
Author: Tobias Gustafsson
@@ -8,7 +8,7 @@
License: MIT
Description: Pyrsistent
==========
- .. image:: https://travis-ci.org/tobgu/pyrsistent.png?branch=master
+ .. image:: https://travis-ci.org/tobgu/pyrsistent.svg?branch=master
:target: https://travis-ci.org/tobgu/pyrsistent
.. image:: https://badge.fury.io/py/pyrsistent.svg
@@ -20,7 +20,7 @@
.. _Pyrthon: https://www.github.com/tobgu/pyrthon/
- Pyrsistent is a number of persistent collections (by some referred to
as functional data structures). Persistent in
+ Pyrsistent is a number of persistent collections (by some referred to
as functional data structures). Persistent in
the sense that they are immutable.
All methods on a data structure that would normally mutate it instead
return a new copy of the structure containing the
@@ -230,7 +230,7 @@
Custom types (classes) that are iterable should be wrapped in a tuple
to prevent their
- members being added to the set of valid types. Although Enums in
particular are now
+ members being added to the set of valid types. Although Enums in
particular are now
supported without wrapping, see #83 for more information.
Mandatory fields
@@ -337,7 +337,7 @@
... map_int_to_str = pmap_field(int, str)
... vector_of_strs = pvector_field(str)
...
-
+
Serialization
*************
PRecords support serialization back to dicts. Default serialization
will take keys and values
@@ -570,34 +570,20 @@
Compatibility
-------------
- Pyrsistent is developed and tested on Python 2.7, 3.5, 3.6, 3.7 and
PyPy (Python 2 and 3 compatible). It will most
- likely work on all other versions >= 3.4 but no guarantees are given.
:)
-
- Compatibility issues
- ~~~~~~~~~~~~~~~~~~~~
-
- .. _27: https://github.com/tobgu/pyrsistent/issues/27
-
- There is currently one known compatibility issue when comparing built
in sets and frozensets to PSets as discussed in 27_.
- It affects python 2 versions < 2.7.8 and python 3 versions < 3.4.0 and
is due to a bug described in
- http://bugs.python.org/issue8743.
-
- Comparisons will fail or be incorrect when using the set/frozenset as
left hand side of the comparison. As a workaround
- you need to either upgrade Python to a more recent version, avoid
comparing sets/frozensets with PSets or always make
- sure to convert both sides of the comparison to the same type before
performing the comparison.
+ Pyrsistent is developed and tested on Python 3.5, 3.6, 3.7, 3.8 and
PyPy3.
Performance
-----------
- Pyrsistent is developed with performance in mind. Still, while some
operations are nearly on par with their built in,
+ Pyrsistent is developed with performance in mind. Still, while some
operations are nearly on par with their built in,
mutable, counterparts in terms of speed, other operations are slower.
In the cases where attempts at
optimizations have been done, speed has generally been valued over
space.
- Pyrsistent comes with two API compatible flavors of PVector (on which
PMap and PSet are based), one pure Python
+ Pyrsistent comes with two API compatible flavors of PVector (on which
PMap and PSet are based), one pure Python
implementation and one implemented as a C extension. The latter
generally being 2 - 20 times faster than the former.
The C extension will be used automatically when possible.
- The pure python implementation is fully PyPy compatible. Running it
under PyPy speeds operations up considerably if
+ The pure python implementation is fully PyPy compatible. Running it
under PyPy speeds operations up considerably if
the structures are used heavily (if JITed), for some cases the
performance is almost on par with the built in counterparts.
Type hints
@@ -692,6 +678,12 @@
johnthagen https://github.com/johnthagen
+ Bastien Vallet https://github.com/djailla
+
+ Ram Rachum https://github.com/cool-RR
+
+ Vincent Philippon https://github.com/vphilippon
+
Contributing
------------
@@ -706,16 +698,19 @@
Install tox: ``pip install tox``
- Run test for Python 2.7: ``tox -epy27``
+ Run test for Python 3.8: ``tox -e py38``
Release
~~~~~~~
+ * `pip install -r requirements.txt`
* Update CHANGES.txt
* Update README with any new contributors and potential info needed.
* Update _pyrsistent_version.py
- * python setup.py sdist upload
- * Commit and tag with new version: git add -u . && git commit -m
'Prepare version vX.Y.Z' && git tag -a vX.Y.Z -m 'vX.Y.Z'
- * Push commit and tags: git push && git push --tags
+ * `rm -rf dist/* && python setup.py sdist`
+ * (`twine upload -r testpypi dist/*`), if testing the distribution on
testpypi
+ * `twine upload dist/*`
+ * Commit and tag with new version: `git add -u . && git commit -m
'Prepare version vX.Y.Z' && git tag -a vX.Y.Z -m 'vX.Y.Z'`
+ * Push commit and tags: `git push && git push --tags`
Project status
--------------
@@ -739,4 +734,6 @@
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 :: Implementation :: PyPy
+Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/README new/pyrsistent-0.17.3/README
--- old/pyrsistent-0.16.0/README 2020-03-24 20:45:19.000000000 +0100
+++ new/pyrsistent-0.17.3/README 2020-09-13 08:54:05.000000000 +0200
@@ -1,6 +1,6 @@
Pyrsistent
==========
-.. image:: https://travis-ci.org/tobgu/pyrsistent.png?branch=master
+.. image:: https://travis-ci.org/tobgu/pyrsistent.svg?branch=master
:target: https://travis-ci.org/tobgu/pyrsistent
.. image:: https://badge.fury.io/py/pyrsistent.svg
@@ -12,7 +12,7 @@
.. _Pyrthon: https://www.github.com/tobgu/pyrthon/
-Pyrsistent is a number of persistent collections (by some referred to as
functional data structures). Persistent in
+Pyrsistent is a number of persistent collections (by some referred to as
functional data structures). Persistent in
the sense that they are immutable.
All methods on a data structure that would normally mutate it instead return a
new copy of the structure containing the
@@ -222,7 +222,7 @@
Custom types (classes) that are iterable should be wrapped in a tuple to
prevent their
-members being added to the set of valid types. Although Enums in particular
are now
+members being added to the set of valid types. Although Enums in particular
are now
supported without wrapping, see #83 for more information.
Mandatory fields
@@ -329,7 +329,7 @@
... map_int_to_str = pmap_field(int, str)
... vector_of_strs = pvector_field(str)
...
-
+
Serialization
*************
PRecords support serialization back to dicts. Default serialization will take
keys and values
@@ -562,34 +562,20 @@
Compatibility
-------------
-Pyrsistent is developed and tested on Python 2.7, 3.5, 3.6, 3.7 and PyPy
(Python 2 and 3 compatible). It will most
-likely work on all other versions >= 3.4 but no guarantees are given. :)
-
-Compatibility issues
-~~~~~~~~~~~~~~~~~~~~
-
-.. _27: https://github.com/tobgu/pyrsistent/issues/27
-
-There is currently one known compatibility issue when comparing built in sets
and frozensets to PSets as discussed in 27_.
-It affects python 2 versions < 2.7.8 and python 3 versions < 3.4.0 and is due
to a bug described in
-http://bugs.python.org/issue8743.
-
-Comparisons will fail or be incorrect when using the set/frozenset as left
hand side of the comparison. As a workaround
-you need to either upgrade Python to a more recent version, avoid comparing
sets/frozensets with PSets or always make
-sure to convert both sides of the comparison to the same type before
performing the comparison.
+Pyrsistent is developed and tested on Python 3.5, 3.6, 3.7, 3.8 and PyPy3.
Performance
-----------
-Pyrsistent is developed with performance in mind. Still, while some operations
are nearly on par with their built in,
+Pyrsistent is developed with performance in mind. Still, while some operations
are nearly on par with their built in,
mutable, counterparts in terms of speed, other operations are slower. In the
cases where attempts at
optimizations have been done, speed has generally been valued over space.
-Pyrsistent comes with two API compatible flavors of PVector (on which PMap and
PSet are based), one pure Python
+Pyrsistent comes with two API compatible flavors of PVector (on which PMap and
PSet are based), one pure Python
implementation and one implemented as a C extension. The latter generally
being 2 - 20 times faster than the former.
The C extension will be used automatically when possible.
-The pure python implementation is fully PyPy compatible. Running it under PyPy
speeds operations up considerably if
+The pure python implementation is fully PyPy compatible. Running it under PyPy
speeds operations up considerably if
the structures are used heavily (if JITed), for some cases the performance is
almost on par with the built in counterparts.
Type hints
@@ -684,6 +670,12 @@
johnthagen https://github.com/johnthagen
+Bastien Vallet https://github.com/djailla
+
+Ram Rachum https://github.com/cool-RR
+
+Vincent Philippon https://github.com/vphilippon
+
Contributing
------------
@@ -698,16 +690,19 @@
Install tox: ``pip install tox``
-Run test for Python 2.7: ``tox -epy27``
+Run test for Python 3.8: ``tox -e py38``
Release
~~~~~~~
+* `pip install -r requirements.txt`
* Update CHANGES.txt
* Update README with any new contributors and potential info needed.
* Update _pyrsistent_version.py
-* python setup.py sdist upload
-* Commit and tag with new version: git add -u . && git commit -m 'Prepare
version vX.Y.Z' && git tag -a vX.Y.Z -m 'vX.Y.Z'
-* Push commit and tags: git push && git push --tags
+* `rm -rf dist/* && python setup.py sdist`
+* (`twine upload -r testpypi dist/*`), if testing the distribution on testpypi
+* `twine upload dist/*`
+* Commit and tag with new version: `git add -u . && git commit -m 'Prepare
version vX.Y.Z' && git tag -a vX.Y.Z -m 'vX.Y.Z'`
+* Push commit and tags: `git push && git push --tags`
Project status
--------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/README.rst
new/pyrsistent-0.17.3/README.rst
--- old/pyrsistent-0.16.0/README.rst 2020-03-24 20:45:19.000000000 +0100
+++ new/pyrsistent-0.17.3/README.rst 2020-09-13 08:54:05.000000000 +0200
@@ -1,6 +1,6 @@
Pyrsistent
==========
-.. image:: https://travis-ci.org/tobgu/pyrsistent.png?branch=master
+.. image:: https://travis-ci.org/tobgu/pyrsistent.svg?branch=master
:target: https://travis-ci.org/tobgu/pyrsistent
.. image:: https://badge.fury.io/py/pyrsistent.svg
@@ -12,7 +12,7 @@
.. _Pyrthon: https://www.github.com/tobgu/pyrthon/
-Pyrsistent is a number of persistent collections (by some referred to as
functional data structures). Persistent in
+Pyrsistent is a number of persistent collections (by some referred to as
functional data structures). Persistent in
the sense that they are immutable.
All methods on a data structure that would normally mutate it instead return a
new copy of the structure containing the
@@ -222,7 +222,7 @@
Custom types (classes) that are iterable should be wrapped in a tuple to
prevent their
-members being added to the set of valid types. Although Enums in particular
are now
+members being added to the set of valid types. Although Enums in particular
are now
supported without wrapping, see #83 for more information.
Mandatory fields
@@ -329,7 +329,7 @@
... map_int_to_str = pmap_field(int, str)
... vector_of_strs = pvector_field(str)
...
-
+
Serialization
*************
PRecords support serialization back to dicts. Default serialization will take
keys and values
@@ -562,34 +562,20 @@
Compatibility
-------------
-Pyrsistent is developed and tested on Python 2.7, 3.5, 3.6, 3.7 and PyPy
(Python 2 and 3 compatible). It will most
-likely work on all other versions >= 3.4 but no guarantees are given. :)
-
-Compatibility issues
-~~~~~~~~~~~~~~~~~~~~
-
-.. _27: https://github.com/tobgu/pyrsistent/issues/27
-
-There is currently one known compatibility issue when comparing built in sets
and frozensets to PSets as discussed in 27_.
-It affects python 2 versions < 2.7.8 and python 3 versions < 3.4.0 and is due
to a bug described in
-http://bugs.python.org/issue8743.
-
-Comparisons will fail or be incorrect when using the set/frozenset as left
hand side of the comparison. As a workaround
-you need to either upgrade Python to a more recent version, avoid comparing
sets/frozensets with PSets or always make
-sure to convert both sides of the comparison to the same type before
performing the comparison.
+Pyrsistent is developed and tested on Python 3.5, 3.6, 3.7, 3.8 and PyPy3.
Performance
-----------
-Pyrsistent is developed with performance in mind. Still, while some operations
are nearly on par with their built in,
+Pyrsistent is developed with performance in mind. Still, while some operations
are nearly on par with their built in,
mutable, counterparts in terms of speed, other operations are slower. In the
cases where attempts at
optimizations have been done, speed has generally been valued over space.
-Pyrsistent comes with two API compatible flavors of PVector (on which PMap and
PSet are based), one pure Python
+Pyrsistent comes with two API compatible flavors of PVector (on which PMap and
PSet are based), one pure Python
implementation and one implemented as a C extension. The latter generally
being 2 - 20 times faster than the former.
The C extension will be used automatically when possible.
-The pure python implementation is fully PyPy compatible. Running it under PyPy
speeds operations up considerably if
+The pure python implementation is fully PyPy compatible. Running it under PyPy
speeds operations up considerably if
the structures are used heavily (if JITed), for some cases the performance is
almost on par with the built in counterparts.
Type hints
@@ -684,6 +670,12 @@
johnthagen https://github.com/johnthagen
+Bastien Vallet https://github.com/djailla
+
+Ram Rachum https://github.com/cool-RR
+
+Vincent Philippon https://github.com/vphilippon
+
Contributing
------------
@@ -698,16 +690,19 @@
Install tox: ``pip install tox``
-Run test for Python 2.7: ``tox -epy27``
+Run test for Python 3.8: ``tox -e py38``
Release
~~~~~~~
+* `pip install -r requirements.txt`
* Update CHANGES.txt
* Update README with any new contributors and potential info needed.
* Update _pyrsistent_version.py
-* python setup.py sdist upload
-* Commit and tag with new version: git add -u . && git commit -m 'Prepare
version vX.Y.Z' && git tag -a vX.Y.Z -m 'vX.Y.Z'
-* Push commit and tags: git push && git push --tags
+* `rm -rf dist/* && python setup.py sdist`
+* (`twine upload -r testpypi dist/*`), if testing the distribution on testpypi
+* `twine upload dist/*`
+* Commit and tag with new version: `git add -u . && git commit -m 'Prepare
version vX.Y.Z' && git tag -a vX.Y.Z -m 'vX.Y.Z'`
+* Push commit and tags: `git push && git push --tags`
Project status
--------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/_pyrsistent_version.py
new/pyrsistent-0.17.3/_pyrsistent_version.py
--- old/pyrsistent-0.16.0/_pyrsistent_version.py 2020-03-24
20:45:19.000000000 +0100
+++ new/pyrsistent-0.17.3/_pyrsistent_version.py 2020-09-13
09:01:29.000000000 +0200
@@ -1 +1 @@
-__version__ = '0.16.0'
+__version__ = '0.17.3'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_checked_types.py
new/pyrsistent-0.17.3/pyrsistent/_checked_types.py
--- old/pyrsistent-0.16.0/pyrsistent/_checked_types.py 2020-01-23
22:10:43.000000000 +0100
+++ new/pyrsistent-0.17.3/pyrsistent/_checked_types.py 2020-09-13
08:53:39.000000000 +0200
@@ -1,7 +1,7 @@
-from ._compat import Iterable
-import six
+from enum import Enum
+
+from collections.abc import Iterable
-from pyrsistent._compat import Enum, string_types
from pyrsistent._pmap import PMap, pmap
from pyrsistent._pset import PSet, pset
from pyrsistent._pvector import PythonPVector, python_pvector
@@ -48,7 +48,7 @@
_preserved_iterable_types = (
- Enum,
+ Enum,
)
"""Some types are themselves iterable, but we want to use the type itself and
not its members for the type specification. This defines a set of such types
@@ -69,7 +69,7 @@
"""
is_type = isinstance(t, type)
is_preserved = isinstance(t, type) and issubclass(t,
_preserved_iterable_types)
- is_string = isinstance(t, string_types)
+ is_string = isinstance(t, str)
is_iterable = isinstance(t, Iterable)
if is_preserved:
@@ -268,8 +268,7 @@
return cls(source_data)
[email protected]_metaclass(_CheckedTypeMeta)
-class CheckedPVector(PythonPVector, CheckedType):
+class CheckedPVector(PythonPVector, CheckedType, metaclass=_CheckedTypeMeta):
"""
A CheckedPVector is a PVector which allows specifying type and invariant
checks.
@@ -355,8 +354,7 @@
return CheckedPVector.Evolver(self.__class__, self)
[email protected]_metaclass(_CheckedTypeMeta)
-class CheckedPSet(PSet, CheckedType):
+class CheckedPSet(PSet, CheckedType, metaclass=_CheckedTypeMeta):
"""
A CheckedPSet is a PSet which allows specifying type and invariant checks.
@@ -454,8 +452,7 @@
_UNDEFINED_CHECKED_PMAP_SIZE = object()
[email protected]_metaclass(_CheckedMapTypeMeta)
-class CheckedPMap(PMap, CheckedType):
+class CheckedPMap(PMap, CheckedType, metaclass=_CheckedMapTypeMeta):
"""
A CheckedPMap is a PMap which allows specifying type and invariant checks.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_compat.py
new/pyrsistent-0.17.3/pyrsistent/_compat.py
--- old/pyrsistent-0.16.0/pyrsistent/_compat.py 2018-10-14 12:06:35.000000000
+0200
+++ new/pyrsistent-0.17.3/pyrsistent/_compat.py 1970-01-01 01:00:00.000000000
+0100
@@ -1,31 +0,0 @@
-from six import string_types
-
-
-# enum compat
-try:
- from enum import Enum
-except:
- class Enum(object): pass
- # no objects will be instances of this class
-
-# collections compat
-try:
- from collections.abc import (
- Container,
- Hashable,
- Iterable,
- Mapping,
- Sequence,
- Set,
- Sized,
- )
-except ImportError:
- from collections import (
- Container,
- Hashable,
- Iterable,
- Mapping,
- Sequence,
- Set,
- Sized,
- )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_field_common.py
new/pyrsistent-0.17.3/pyrsistent/_field_common.py
--- old/pyrsistent-0.16.0/pyrsistent/_field_common.py 2020-03-24
20:34:57.000000000 +0100
+++ new/pyrsistent-0.17.3/pyrsistent/_field_common.py 2020-09-13
08:53:39.000000000 +0200
@@ -1,4 +1,3 @@
-import six
import sys
from pyrsistent._checked_types import (
@@ -139,7 +138,7 @@
def _check_field_parameters(field):
for t in field.type:
- if not isinstance(t, type) and not isinstance(t, six.string_types):
+ if not isinstance(t, type) and not isinstance(t, str):
raise TypeError('Type parameter expected, not {0}'.format(type(t)))
if field.initial is not PFIELD_NO_INITIAL and \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_helpers.py
new/pyrsistent-0.17.3/pyrsistent/_helpers.py
--- old/pyrsistent-0.16.0/pyrsistent/_helpers.py 2020-01-23
22:12:35.000000000 +0100
+++ new/pyrsistent-0.17.3/pyrsistent/_helpers.py 2020-09-13
08:53:39.000000000 +0200
@@ -1,5 +1,4 @@
from functools import wraps
-import six
from pyrsistent._pmap import PMap, pmap
from pyrsistent._pset import PSet, pset
from pyrsistent._pvector import PVector, pvector
@@ -29,7 +28,7 @@
"""
typ = type(o)
if typ is dict:
- return pmap(dict((k, freeze(v)) for k, v in six.iteritems(o)))
+ return pmap(dict((k, freeze(v)) for k, v in o.items()))
if typ is list:
return pvector(map(freeze, o))
if typ is tuple:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_immutable.py
new/pyrsistent-0.17.3/pyrsistent/_immutable.py
--- old/pyrsistent-0.16.0/pyrsistent/_immutable.py 2018-07-08
09:16:39.000000000 +0200
+++ new/pyrsistent-0.17.3/pyrsistent/_immutable.py 2020-09-13
08:53:39.000000000 +0200
@@ -1,7 +1,5 @@
import sys
-import six
-
def immutable(members='', name='Immutable', verbose=False):
"""
@@ -48,7 +46,7 @@
AttributeError: Cannot set frozen members id_
"""
- if isinstance(members, six.string_types):
+ if isinstance(members, str):
members = members.replace(',', ' ').split()
def frozen_member_test():
@@ -98,8 +96,8 @@
from collections import namedtuple
namespace = dict(namedtuple=namedtuple, __name__='pyrsistent_immutable')
try:
- six.exec_(template, namespace)
+ exec(template, namespace)
except SyntaxError as e:
- raise SyntaxError(e.message + ':\n' + template)
+ raise SyntaxError(e.message + ':\n' + template) from e
- return namespace[name]
\ No newline at end of file
+ return namespace[name]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_pbag.py
new/pyrsistent-0.17.3/pyrsistent/_pbag.py
--- old/pyrsistent-0.16.0/pyrsistent/_pbag.py 2018-10-14 12:06:35.000000000
+0200
+++ new/pyrsistent-0.17.3/pyrsistent/_pbag.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,4 +1,4 @@
-from ._compat import Container, Iterable, Sized, Hashable
+from collections.abc import Container, Iterable, Sized, Hashable
from functools import reduce
from pyrsistent._pmap import pmap
@@ -154,7 +154,7 @@
# Multiset-style operations similar to collections.Counter
def __add__(self, other):
- """
+ """
Combine elements from two PBags.
>>> pbag([1, 2, 2]) + pbag([2, 3, 3])
@@ -168,7 +168,7 @@
return PBag(result.persistent())
def __sub__(self, other):
- """
+ """
Remove elements from one PBag that are present in another.
>>> pbag([1, 2, 2, 2, 3]) - pbag([2, 3, 3, 4])
@@ -184,9 +184,9 @@
elif elem in self:
result.remove(elem)
return PBag(result.persistent())
-
+
def __or__(self, other):
- """
+ """
Union: Keep elements that are present in either of two PBags.
>>> pbag([1, 2, 2, 2]) | pbag([2, 3, 3])
@@ -200,11 +200,11 @@
newcount = max(count, other_count)
result[elem] = newcount
return PBag(result.persistent())
-
+
def __and__(self, other):
"""
Intersection: Only keep elements that are present in both PBags.
-
+
>>> pbag([1, 2, 2, 2]) & pbag([2, 3, 3])
pbag([2])
"""
@@ -216,7 +216,7 @@
if newcount > 0:
result[elem] = newcount
return PBag(result.persistent())
-
+
def __hash__(self):
"""
Hash based on value of elements.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_pclass.py
new/pyrsistent-0.17.3/pyrsistent/_pclass.py
--- old/pyrsistent-0.16.0/pyrsistent/_pclass.py 2019-05-12 14:07:03.000000000
+0200
+++ new/pyrsistent-0.17.3/pyrsistent/_pclass.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,4 +1,3 @@
-import six
from pyrsistent._checked_types import (InvariantException, CheckedType,
_restore_pickle, store_invariants)
from pyrsistent._field_common import (
set_fields, check_type, is_field_ignore_extra_complaint,
PFIELD_NO_INITIAL, serialize, check_global_invariants
@@ -35,8 +34,7 @@
setattr(result, name, value)
[email protected]_metaclass(PClassMeta)
-class PClass(CheckedType):
+class PClass(CheckedType, metaclass=PClassMeta):
"""
A PClass is a python class with a fixed set of specified fields. PClasses
are declared as python classes inheriting
from PClass. It is defined the same way that PRecords are and behaves like
a PRecord in all aspects except that it
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_pdeque.py
new/pyrsistent-0.17.3/pyrsistent/_pdeque.py
--- old/pyrsistent-0.16.0/pyrsistent/_pdeque.py 2018-10-14 12:06:35.000000000
+0200
+++ new/pyrsistent-0.17.3/pyrsistent/_pdeque.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,4 +1,4 @@
-from ._compat import Sequence, Hashable
+from collections.abc import Sequence, Hashable
from itertools import islice, chain
from numbers import Integral
from pyrsistent._plist import plist
@@ -276,8 +276,8 @@
# This is severely inefficient with a double reverse, should
perhaps implement a remove_last()?
return PDeque(self._left_list,
self._right_list.reverse().remove(elem).reverse(), self._length - 1)
- except ValueError:
- raise ValueError('{0} not found in PDeque'.format(elem))
+ except ValueError as e:
+ raise ValueError('{0} not found in PDeque'.format(elem)) from e
def reverse(self):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_plist.py
new/pyrsistent-0.17.3/pyrsistent/_plist.py
--- old/pyrsistent-0.16.0/pyrsistent/_plist.py 2018-10-14 12:06:35.000000000
+0200
+++ new/pyrsistent-0.17.3/pyrsistent/_plist.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,4 +1,4 @@
-from ._compat import Sequence, Hashable
+from collections.abc import Sequence, Hashable
from numbers import Integral
from functools import reduce
@@ -143,7 +143,7 @@
def __eq__(self, other):
"""
Traverses the lists, checking equality of elements.
-
+
This is an O(n) operation, but preserves the standard semantics of
list equality.
"""
if not isinstance(other, _PListBase):
@@ -179,8 +179,8 @@
try:
return self._drop(index).first
- except AttributeError:
- raise IndexError("PList index out of range")
+ except AttributeError as e:
+ raise IndexError("PList index out of range") from e
def _drop(self, count):
if count < 0:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_pmap.py
new/pyrsistent-0.17.3/pyrsistent/_pmap.py
--- old/pyrsistent-0.16.0/pyrsistent/_pmap.py 2020-01-23 22:24:56.000000000
+0100
+++ new/pyrsistent-0.17.3/pyrsistent/_pmap.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,6 +1,5 @@
-from ._compat import Mapping, Hashable
+from collections.abc import Mapping, Hashable
from itertools import chain
-import six
from pyrsistent._pvector import pvector
from pyrsistent._transformations import transform
@@ -93,10 +92,10 @@
def __getattr__(self, key):
try:
return self[key]
- except KeyError:
+ except KeyError as e:
raise AttributeError(
"{0} has no attribute '{1}'".format(type(self).__name__, key)
- )
+ ) from e
def iterkeys(self):
for k, _ in self.iteritems():
@@ -146,7 +145,7 @@
return dict(self.iteritems()) == dict(other.iteritems())
elif isinstance(other, dict):
return dict(self.iteritems()) == other
- return dict(self.iteritems()) == dict(six.iteritems(other))
+ return dict(self.iteritems()) == dict(other.items())
__ne__ = Mapping.__ne__
@@ -418,7 +417,7 @@
# key collisions
initial = dict(initial)
- for k, v in six.iteritems(initial):
+ for k, v in initial.items():
h = hash(k)
index = h % size
bucket = buckets[index]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_precord.py
new/pyrsistent-0.17.3/pyrsistent/_precord.py
--- old/pyrsistent-0.16.0/pyrsistent/_precord.py 2019-05-12
14:07:03.000000000 +0200
+++ new/pyrsistent-0.17.3/pyrsistent/_precord.py 2020-09-13
08:53:39.000000000 +0200
@@ -1,4 +1,3 @@
-import six
from pyrsistent._checked_types import CheckedType, _restore_pickle,
InvariantException, store_invariants
from pyrsistent._field_common import (
set_fields, check_type, is_field_ignore_extra_complaint,
PFIELD_NO_INITIAL, serialize, check_global_invariants
@@ -23,8 +22,7 @@
return super(_PRecordMeta, mcs).__new__(mcs, name, bases, dct)
[email protected]_metaclass(_PRecordMeta)
-class PRecord(PMap, CheckedType):
+class PRecord(PMap, CheckedType, metaclass=_PRecordMeta):
"""
A PRecord is a PMap with a fixed set of specified fields. Records are
declared as python classes inheriting
from PRecord. Because it is a PMap it has full support for all Mapping
methods such as iteration and element
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_pset.py
new/pyrsistent-0.17.3/pyrsistent/_pset.py
--- old/pyrsistent-0.16.0/pyrsistent/_pset.py 2018-10-14 12:06:35.000000000
+0200
+++ new/pyrsistent-0.17.3/pyrsistent/_pset.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,9 +1,7 @@
-from ._compat import Set, Hashable
+from collections.abc import Set, Hashable
import sys
from pyrsistent._pmap import pmap
-PY2 = sys.version_info[0] < 3
-
class PSet(object):
"""
@@ -44,7 +42,7 @@
return len(self._map)
def __repr__(self):
- if PY2 or not self:
+ if not self:
return 'p' + str(set(self))
return 'pset([{0}])'.format(str(set(self))[1:-1])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_pvector.py
new/pyrsistent-0.17.3/pyrsistent/_pvector.py
--- old/pyrsistent-0.16.0/pyrsistent/_pvector.py 2019-07-04
22:05:29.000000000 +0200
+++ new/pyrsistent-0.17.3/pyrsistent/_pvector.py 2020-09-13
08:53:39.000000000 +0200
@@ -1,8 +1,7 @@
from abc import abstractmethod, ABCMeta
-from ._compat import Sequence, Hashable
+from collections.abc import Sequence, Hashable
from numbers import Integral
import operator
-import six
from pyrsistent._transformations import transform
@@ -411,8 +410,7 @@
l.remove(value)
return _EMPTY_PVECTOR.extend(l)
[email protected]_metaclass(ABCMeta)
-class PVector(object):
+class PVector(metaclass=ABCMeta):
"""
Persistent vector implementation. Meant as a replacement for the cases
where you would normally
use a Python list.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_toolz.py
new/pyrsistent-0.17.3/pyrsistent/_toolz.py
--- old/pyrsistent-0.16.0/pyrsistent/_toolz.py 2018-07-07 15:53:48.000000000
+0200
+++ new/pyrsistent-0.17.3/pyrsistent/_toolz.py 2020-09-13 08:53:39.000000000
+0200
@@ -39,7 +39,7 @@
DAMAGE.
"""
import operator
-from six.moves import reduce
+from functools import reduce
def get_in(keys, coll, default=None, no_default=False):
@@ -80,4 +80,4 @@
except (KeyError, IndexError, TypeError):
if no_default:
raise
- return default
\ No newline at end of file
+ return default
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent/_transformations.py
new/pyrsistent-0.17.3/pyrsistent/_transformations.py
--- old/pyrsistent-0.16.0/pyrsistent/_transformations.py 2019-05-11
08:24:44.000000000 +0200
+++ new/pyrsistent-0.17.3/pyrsistent/_transformations.py 2020-09-13
08:53:39.000000000 +0200
@@ -1,13 +1,9 @@
import re
-import six
try:
from inspect import Parameter, signature
except ImportError:
signature = None
- try:
- from inspect import getfullargspec as getargspec
- except ImportError:
- from inspect import getargspec
+ from inspect import getfullargspec
_EMPTY_SENTINEL = object()
@@ -35,7 +31,7 @@
def rex(expr):
""" Regular expression matcher to use together with transform functions """
r = re.compile(expr)
- return lambda key: isinstance(key, six.string_types) and r.match(key)
+ return lambda key: isinstance(key, str) and r.match(key)
def ny(_):
@@ -107,7 +103,7 @@
if signature is None:
def _get_arity(f):
- argspec = getargspec(f)
+ argspec = getfullargspec(f)
return len(argspec.args) - len(argspec.defaults or ())
else:
def _get_arity(f):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent.egg-info/PKG-INFO
new/pyrsistent-0.17.3/pyrsistent.egg-info/PKG-INFO
--- old/pyrsistent-0.16.0/pyrsistent.egg-info/PKG-INFO 2020-03-24
20:46:32.000000000 +0100
+++ new/pyrsistent-0.17.3/pyrsistent.egg-info/PKG-INFO 2020-09-13
09:04:48.000000000 +0200
@@ -1,6 +1,6 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
Name: pyrsistent
-Version: 0.16.0
+Version: 0.17.3
Summary: Persistent/Functional/Immutable data structures
Home-page: http://github.com/tobgu/pyrsistent/
Author: Tobias Gustafsson
@@ -8,7 +8,7 @@
License: MIT
Description: Pyrsistent
==========
- .. image:: https://travis-ci.org/tobgu/pyrsistent.png?branch=master
+ .. image:: https://travis-ci.org/tobgu/pyrsistent.svg?branch=master
:target: https://travis-ci.org/tobgu/pyrsistent
.. image:: https://badge.fury.io/py/pyrsistent.svg
@@ -20,7 +20,7 @@
.. _Pyrthon: https://www.github.com/tobgu/pyrthon/
- Pyrsistent is a number of persistent collections (by some referred to
as functional data structures). Persistent in
+ Pyrsistent is a number of persistent collections (by some referred to
as functional data structures). Persistent in
the sense that they are immutable.
All methods on a data structure that would normally mutate it instead
return a new copy of the structure containing the
@@ -230,7 +230,7 @@
Custom types (classes) that are iterable should be wrapped in a tuple
to prevent their
- members being added to the set of valid types. Although Enums in
particular are now
+ members being added to the set of valid types. Although Enums in
particular are now
supported without wrapping, see #83 for more information.
Mandatory fields
@@ -337,7 +337,7 @@
... map_int_to_str = pmap_field(int, str)
... vector_of_strs = pvector_field(str)
...
-
+
Serialization
*************
PRecords support serialization back to dicts. Default serialization
will take keys and values
@@ -570,34 +570,20 @@
Compatibility
-------------
- Pyrsistent is developed and tested on Python 2.7, 3.5, 3.6, 3.7 and
PyPy (Python 2 and 3 compatible). It will most
- likely work on all other versions >= 3.4 but no guarantees are given.
:)
-
- Compatibility issues
- ~~~~~~~~~~~~~~~~~~~~
-
- .. _27: https://github.com/tobgu/pyrsistent/issues/27
-
- There is currently one known compatibility issue when comparing built
in sets and frozensets to PSets as discussed in 27_.
- It affects python 2 versions < 2.7.8 and python 3 versions < 3.4.0 and
is due to a bug described in
- http://bugs.python.org/issue8743.
-
- Comparisons will fail or be incorrect when using the set/frozenset as
left hand side of the comparison. As a workaround
- you need to either upgrade Python to a more recent version, avoid
comparing sets/frozensets with PSets or always make
- sure to convert both sides of the comparison to the same type before
performing the comparison.
+ Pyrsistent is developed and tested on Python 3.5, 3.6, 3.7, 3.8 and
PyPy3.
Performance
-----------
- Pyrsistent is developed with performance in mind. Still, while some
operations are nearly on par with their built in,
+ Pyrsistent is developed with performance in mind. Still, while some
operations are nearly on par with their built in,
mutable, counterparts in terms of speed, other operations are slower.
In the cases where attempts at
optimizations have been done, speed has generally been valued over
space.
- Pyrsistent comes with two API compatible flavors of PVector (on which
PMap and PSet are based), one pure Python
+ Pyrsistent comes with two API compatible flavors of PVector (on which
PMap and PSet are based), one pure Python
implementation and one implemented as a C extension. The latter
generally being 2 - 20 times faster than the former.
The C extension will be used automatically when possible.
- The pure python implementation is fully PyPy compatible. Running it
under PyPy speeds operations up considerably if
+ The pure python implementation is fully PyPy compatible. Running it
under PyPy speeds operations up considerably if
the structures are used heavily (if JITed), for some cases the
performance is almost on par with the built in counterparts.
Type hints
@@ -692,6 +678,12 @@
johnthagen https://github.com/johnthagen
+ Bastien Vallet https://github.com/djailla
+
+ Ram Rachum https://github.com/cool-RR
+
+ Vincent Philippon https://github.com/vphilippon
+
Contributing
------------
@@ -706,16 +698,19 @@
Install tox: ``pip install tox``
- Run test for Python 2.7: ``tox -epy27``
+ Run test for Python 3.8: ``tox -e py38``
Release
~~~~~~~
+ * `pip install -r requirements.txt`
* Update CHANGES.txt
* Update README with any new contributors and potential info needed.
* Update _pyrsistent_version.py
- * python setup.py sdist upload
- * Commit and tag with new version: git add -u . && git commit -m
'Prepare version vX.Y.Z' && git tag -a vX.Y.Z -m 'vX.Y.Z'
- * Push commit and tags: git push && git push --tags
+ * `rm -rf dist/* && python setup.py sdist`
+ * (`twine upload -r testpypi dist/*`), if testing the distribution on
testpypi
+ * `twine upload dist/*`
+ * Commit and tag with new version: `git add -u . && git commit -m
'Prepare version vX.Y.Z' && git tag -a vX.Y.Z -m 'vX.Y.Z'`
+ * Push commit and tags: `git push && git push --tags`
Project status
--------------
@@ -739,4 +734,6 @@
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 :: Implementation :: PyPy
+Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent.egg-info/SOURCES.txt
new/pyrsistent-0.17.3/pyrsistent.egg-info/SOURCES.txt
--- old/pyrsistent-0.16.0/pyrsistent.egg-info/SOURCES.txt 2020-03-24
20:46:32.000000000 +0100
+++ new/pyrsistent-0.17.3/pyrsistent.egg-info/SOURCES.txt 2020-09-13
09:04:48.000000000 +0200
@@ -10,7 +10,6 @@
pyrsistent/__init__.py
pyrsistent/__init__.pyi
pyrsistent/_checked_types.py
-pyrsistent/_compat.py
pyrsistent/_field_common.py
pyrsistent/_helpers.py
pyrsistent/_immutable.py
@@ -30,7 +29,6 @@
pyrsistent.egg-info/PKG-INFO
pyrsistent.egg-info/SOURCES.txt
pyrsistent.egg-info/dependency_links.txt
-pyrsistent.egg-info/requires.txt
pyrsistent.egg-info/top_level.txt
tests/bag_test.py
tests/checked_map_test.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/pyrsistent.egg-info/requires.txt
new/pyrsistent-0.17.3/pyrsistent.egg-info/requires.txt
--- old/pyrsistent-0.16.0/pyrsistent.egg-info/requires.txt 2020-03-24
20:46:32.000000000 +0100
+++ new/pyrsistent-0.17.3/pyrsistent.egg-info/requires.txt 1970-01-01
01:00:00.000000000 +0100
@@ -1 +0,0 @@
-six
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/setup.py
new/pyrsistent-0.17.3/setup.py
--- old/pyrsistent-0.16.0/setup.py 2020-01-23 21:48:31.000000000 +0100
+++ new/pyrsistent-0.17.3/setup.py 2020-09-13 08:59:14.000000000 +0200
@@ -67,6 +67,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: PyPy',
],
test_suite='tests',
@@ -75,7 +76,7 @@
setup_requires=pytest_runner,
ext_modules=extensions,
cmdclass={'build_ext': custom_build_ext},
- install_requires=['six'],
packages=['pyrsistent'],
package_data={'pyrsistent': ['py.typed', '__init__.pyi', 'typing.pyi']},
+ python_requires='>=3.5',
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/tests/class_test.py
new/pyrsistent-0.17.3/tests/class_test.py
--- old/pyrsistent-0.16.0/tests/class_test.py 2019-05-12 14:07:03.000000000
+0200
+++ new/pyrsistent-0.17.3/tests/class_test.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,8 +1,7 @@
-from pyrsistent._compat import Hashable
+from collections.abc import Hashable
import math
import pickle
import pytest
-import sys
import uuid
from pyrsistent import (
field, InvariantException, PClass, optional, CheckedPVector,
@@ -411,9 +410,7 @@
except InvariantException as e:
assert '5 is too large' in e.invariant_errors
-# Skipping this test for now but it describes a corner case with using Enums in
-# python 3 as types and a workaround to make it work.
[email protected](sys.version_info < (3, 4) or True, reason="requires
python3.4")
+
def test_enum_key_type():
import enum
class Foo(enum.Enum):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/tests/field_test.py
new/pyrsistent-0.17.3/tests/field_test.py
--- old/pyrsistent-0.16.0/tests/field_test.py 2018-07-07 15:53:48.000000000
+0200
+++ new/pyrsistent-0.17.3/tests/field_test.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,12 +1,8 @@
-from pyrsistent._compat import Enum
+from enum import Enum
from pyrsistent import field, pvector_field
-# NB: This derives from the internal `pyrsistent._compat.Enum` in order to
-# simplify coverage across python versions. Since we use
-# `pyrsistent._compat.Enum` in `pyrsistent`'s implementation, it's useful to
-# use it in the test coverage as well, for consistency.
class TestEnum(Enum):
x = 1
y = 2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/tests/hypothesis_vector_test.py
new/pyrsistent-0.17.3/tests/hypothesis_vector_test.py
--- old/pyrsistent-0.16.0/tests/hypothesis_vector_test.py 2019-07-02
21:03:04.000000000 +0200
+++ new/pyrsistent-0.17.3/tests/hypothesis_vector_test.py 2020-09-13
08:53:39.000000000 +0200
@@ -4,7 +4,7 @@
import gc
-from pyrsistent._compat import Iterable
+from collections.abc import Iterable
from functools import wraps
from pyrsistent import PClass, field
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/tests/map_test.py
new/pyrsistent-0.17.3/tests/map_test.py
--- old/pyrsistent-0.16.0/tests/map_test.py 2019-10-27 21:31:23.000000000
+0100
+++ new/pyrsistent-0.17.3/tests/map_test.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,5 +1,4 @@
-from pyrsistent._compat import Mapping, Hashable
-import six
+from collections.abc import Mapping, Hashable
from operator import add
import pytest
from pyrsistent import pmap, m, PVector
@@ -29,9 +28,9 @@
assert the_map['a'] == 2
assert the_map.a == 2
assert 'a' in the_map
-
+
assert the_map is the_map.discard('b')
-
+
empty_map = the_map.remove('a')
assert len(empty_map) == 0
assert 'a' not in empty_map
@@ -87,12 +86,12 @@
assert the_map['16'] == 16
assert the_map['1699'] == 1699
assert the_map.set('256', 256) is the_map
-
+
new_map = the_map.remove('1600')
assert len(new_map) == 1699
assert '1600' not in new_map
assert new_map['1601'] == 1601
-
+
# Some NOP properties
assert new_map.discard('18888') is new_map
assert '19999' not in new_map
@@ -103,12 +102,12 @@
def test_access_non_existing_element():
map1 = pmap()
assert len(map1) == 0
-
+
map2 = map1.set('1', 1)
assert '1' not in map1
assert map2['1'] == 1
assert '2' not in map2
-
+
def test_overwrite_existing_element():
map1 = pmap({'a': 2})
@@ -223,7 +222,7 @@
def test_update_with_multiple_arguments():
# If same value is present in multiple sources, the rightmost is used.
- x = m(a=1, b=2, c=3)
+ x = m(a=1, b=2, c=3)
y = x.update(m(b=4, c=5), {'c': 6})
assert y == m(a=1, b=4, c=6)
@@ -248,19 +247,19 @@
def test_transform_base_case():
# Works as set when called with only one key
x = m(a=1, b=2)
-
+
assert x.transform(['a'], 3) == m(a=3, b=2)
def test_transform_nested_maps():
x = m(a=1, b=m(c=3, d=m(e=6, f=7)))
-
+
assert x.transform(['b', 'd', 'e'], 999) == m(a=1, b=m(c=3, d=m(e=999,
f=7)))
def test_transform_levels_missing():
x = m(a=1, b=m(c=3))
-
+
assert x.transform(['b', 'd', 'e'], 999) == m(a=1, b=m(c=3, d=m(e=999)))
@@ -284,7 +283,7 @@
assert map[dummy2] == 2
assert map[dummy3] == 3
assert dummy4 not in map
-
+
keys = set()
values = set()
for k, v in map.iteritems():
@@ -296,40 +295,40 @@
map2 = map.set(dummy1, 11)
assert map2[dummy1] == 11
-
+
# Re-use existing structure when inserted element is the same
assert map2.set(dummy1, 11) is map2
-
+
map3 = map.set('a', 22)
assert map3['a'] == 22
assert map3[dummy3] == 3
-
+
# Remove elements
map4 = map.discard(dummy2)
assert len(map4) == 2
assert map4[dummy1] == 1
assert dummy2 not in map4
assert map4[dummy3] == 3
-
+
assert map.discard(dummy4) is map
-
+
# Empty map handling
empty_map = map4.remove(dummy1).remove(dummy3)
assert len(empty_map) == 0
assert empty_map.discard(dummy1) is empty_map
-
+
def test_bitmap_indexed_iteration():
map = pmap({'a': 2, 'b': 1})
keys = set()
values = set()
-
+
count = 0
for k, v in map.iteritems():
count += 1
keys.add(k)
values.add(v)
-
+
assert count == 2
assert keys == set(['a', 'b'])
assert values == set([2, 1])
@@ -339,10 +338,10 @@
values = list(range(0, 2000))
keys = [str(x) for x in values]
init_dict = dict(zip(keys, values))
-
+
hash_dummy1 = HashDummy()
hash_dummy2 = HashDummy()
-
+
# Throw in a couple of hash collision nodes to tests
# those properly as well
init_dict[hash_dummy1] = 12345
@@ -351,11 +350,11 @@
actual_values = set()
actual_keys = set()
-
+
for k, v in map.iteritems():
actual_values.add(v)
actual_keys.add(k)
-
+
assert actual_keys == set(keys + [hash_dummy1, hash_dummy2])
assert actual_values == set(values + [12345, 54321])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/tests/memory_profiling.py
new/pyrsistent-0.17.3/tests/memory_profiling.py
--- old/pyrsistent-0.16.0/tests/memory_profiling.py 2018-07-07
15:53:48.000000000 +0200
+++ new/pyrsistent-0.17.3/tests/memory_profiling.py 2020-09-13
08:53:39.000000000 +0200
@@ -17,17 +17,20 @@
PROFILING_DURATION = 2.0
+
def run_function(fn):
stop = time.time() + PROFILING_DURATION
while time.time() < stop:
fn(pvector)
+
def detect_memory_leak(samples):
# Do not allow a memory usage difference larger than 5% between the
beginning and the end.
# Skip the first samples to get rid of the build up period and the last
sample since it seems
# a little less precise
return abs(1 - (sum(samples[5:8]) / sum(samples[-4:-1]))) > 0.05
+
def profile_tests():
test_functions = [fn for fn in inspect.getmembers(vector_test,
inspect.isfunction)
if fn[0].startswith('test_')]
@@ -40,5 +43,6 @@
result = memory_profiler.memory_usage((run_function, (fn,), {}),
interval=.1)
assert not detect_memory_leak(result), (name, result)
+
if __name__ == "__main__":
profile_tests()
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/tests/record_test.py
new/pyrsistent-0.17.3/tests/record_test.py
--- old/pyrsistent-0.16.0/tests/record_test.py 2020-03-24 20:34:57.000000000
+0100
+++ new/pyrsistent-0.17.3/tests/record_test.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,7 +1,6 @@
import pickle
import datetime
import pytest
-import six
import uuid
from pyrsistent import (
PRecord, field, InvariantException, ny, pset, PSet, CheckedPVector,
@@ -378,8 +377,8 @@
class Application(PRecord):
- name = field(type=(six.text_type,) + six.string_types)
- image = field(type=(six.text_type,) + six.string_types)
+ name = field(type=str)
+ image = field(type=str)
class ApplicationVector(CheckedPVector):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pyrsistent-0.16.0/tests/vector_test.py
new/pyrsistent-0.17.3/tests/vector_test.py
--- old/pyrsistent-0.16.0/tests/vector_test.py 2019-07-27 20:51:01.000000000
+0200
+++ new/pyrsistent-0.17.3/tests/vector_test.py 2020-09-13 08:53:39.000000000
+0200
@@ -1,3 +1,4 @@
+from collections.abc import Hashable, Sequence
import os
import pickle
import pytest
@@ -321,7 +322,6 @@
def test_is_sequence(pvector):
- from pyrsistent._compat import Sequence
assert isinstance(pvector(), Sequence)
@@ -350,7 +350,7 @@
def test_is_hashable(pvector):
- from pyrsistent._compat import Hashable
+
v = pvector([1, 2, 3])
v2 = pvector([1, 2, 3])
@@ -881,7 +881,7 @@
def test_python_no_c_extension_with_environment_variable():
- from six.moves import reload_module
+ from importlib import reload as reload_module
import pyrsistent._pvector
import pyrsistent
import os