Hello community,
here is the log from the commit of package python-pytools for
openSUSE:Leap:15.2 checked in at 2020-03-23 07:13:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-pytools (Old)
and /work/SRC/openSUSE:Leap:15.2/.python-pytools.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytools"
Mon Mar 23 07:13:41 2020 rev:16 rq:787216 version:2020.1
Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/python-pytools/python-pytools.changes
2020-03-02 13:21:52.210220945 +0100
+++
/work/SRC/openSUSE:Leap:15.2/.python-pytools.new.3160/python-pytools.changes
2020-03-23 07:14:14.842511284 +0100
@@ -1,0 +2,6 @@
+Fri Mar 20 09:59:31 UTC 2020 - [email protected]
+
+- version update to 2020.1
+ + No upstream changelog available
+
+-------------------------------------------------------------------
Old:
----
pytools-2019.1.1.tar.gz
New:
----
pytools-2020.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytools.spec ++++++
--- /var/tmp/diff_new_pack.vPmUFW/_old 2020-03-23 07:14:15.178511486 +0100
+++ /var/tmp/diff_new_pack.vPmUFW/_new 2020-03-23 07:14:15.182511488 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-pytools
#
-# 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
@@ -18,21 +18,26 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pytools
-Version: 2019.1.1
+Version: 2020.1
Release: 0
Summary: A collection of tools for Python
License: MIT
Group: Development/Languages/Python
URL: https://pypi.python.org/pypi/pytools
Source0:
https://files.pythonhosted.org/packages/source/p/pytools/pytools-%{version}.tar.gz
-BuildRequires: %{python_module appdirs} >= 1.4.0
+BuildRequires: %{python_module appdirs >= 1.4.0}
BuildRequires: %{python_module base}
-BuildRequires: %{python_module decorator} >= 3.2.0
-BuildRequires: %{python_module numpy} >= 1.6.0
+BuildRequires: %{python_module decorator >= 3.2.0}
+BuildRequires: %{python_module numpy >= 1.6.0}
+BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
-BuildRequires: %{python_module six} >= 1.8.0
+BuildRequires: %{python_module six >= 1.8.0}
BuildRequires: fdupes
+BuildRequires: python-appdirs >= 1.4.0
+BuildRequires: python-decorator >= 3.2.0
+BuildRequires: python-numpy >= 1.6.0
BuildRequires: python-rpm-macros
+BuildRequires: python-six >= 1.8.0
BuildArch: noarch
%python_subpackages
@@ -57,13 +62,10 @@
%install
%python_install
-%python_expand %fdupes %{buildroot}%{python_sitelib}
+%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
-# The tests are successful when run only with python2.
-# When run with python3, the tests require mpi4py and all the
-# necessary libraries and configuration that comes with MPI.
-python2 setup.py test
+%pytest
%files %{python_files}
%license LICENSE
++++++ pytools-2019.1.1.tar.gz -> pytools-2020.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/PKG-INFO new/pytools-2020.1/PKG-INFO
--- old/pytools-2019.1.1/PKG-INFO 2019-04-25 19:15:05.000000000 +0200
+++ new/pytools-2020.1/PKG-INFO 2020-01-15 01:23:36.000000000 +0100
@@ -1,12 +1,25 @@
Metadata-Version: 1.1
Name: pytools
-Version: 2019.1.1
+Version: 2020.1
Summary: A collection of tools for Python
Home-page: http://pypi.python.org/pypi/pytools
Author: Andreas Kloeckner
Author-email: [email protected]
License: MIT
-Description: Pytools is a big bag of things that are "missing" from the Python
standard
+Description: Pytools: Lots of Little Utilities
+ =================================
+
+ .. image::
https://gitlab.tiker.net/inducer/pytools/badges/master/pipeline.svg
+ :alt: Gitlab Build Status
+ :target: https://gitlab.tiker.net/inducer/pytools/commits/master
+ .. image::
https://dev.azure.com/ak-spam/inducer/_apis/build/status/inducer.pytools?branchName=master
+ :alt: Azure Build Status
+ :target:
https://dev.azure.com/ak-spam/inducer/_build/latest?definitionId=2&branchName=master
+ .. image:: https://badge.fury.io/py/pytools.png
+ :alt: Python Package Index Release Page
+ :target: https://pypi.org/project/pytools/
+
+ Pytools is a big bag of things that are "missing" from the Python
standard
library. This is mainly a dependency of my other software packages,
and is
probably of little interest to you unless you use those. If you're
curious
nonetheless, here's what's on offer:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/README.rst
new/pytools-2020.1/README.rst
--- old/pytools-2019.1.1/README.rst 2017-06-14 23:42:47.000000000 +0200
+++ new/pytools-2020.1/README.rst 2019-10-02 00:43:52.000000000 +0200
@@ -1,3 +1,16 @@
+Pytools: Lots of Little Utilities
+=================================
+
+.. image:: https://gitlab.tiker.net/inducer/pytools/badges/master/pipeline.svg
+ :alt: Gitlab Build Status
+ :target: https://gitlab.tiker.net/inducer/pytools/commits/master
+.. image::
https://dev.azure.com/ak-spam/inducer/_apis/build/status/inducer.pytools?branchName=master
+ :alt: Azure Build Status
+ :target:
https://dev.azure.com/ak-spam/inducer/_build/latest?definitionId=2&branchName=master
+.. image:: https://badge.fury.io/py/pytools.png
+ :alt: Python Package Index Release Page
+ :target: https://pypi.org/project/pytools/
+
Pytools is a big bag of things that are "missing" from the Python standard
library. This is mainly a dependency of my other software packages, and is
probably of little interest to you unless you use those. If you're curious
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/pytools/__init__.py
new/pytools-2020.1/pytools/__init__.py
--- old/pytools-2019.1.1/pytools/__init__.py 2019-04-25 19:14:13.000000000
+0200
+++ new/pytools-2020.1/pytools/__init__.py 2020-01-12 17:44:21.000000000
+0100
@@ -149,6 +149,12 @@
.. autoclass:: ProcessLogger
.. autoclass:: DebugProcessLogger
.. autoclass:: log_process
+
+Sorting in natural order
+------------------------
+
+.. autofunction:: natorder
+.. autofunction:: natsorted
"""
@@ -1045,10 +1051,15 @@
# {{{ cartesian products etc.
-def cartesian_product(list1, list2):
- for i in list1:
- for j in list2:
- yield (i, j)
+def cartesian_product(*args):
+ if len(args) == 1:
+ for arg in args[0]:
+ yield (arg,)
+ return
+ first = args[:-1]
+ for prod in cartesian_product(*first):
+ for i in args[-1]:
+ yield prod + (i,)
def distinct_pairs(list1, list2):
@@ -1447,12 +1458,12 @@
col_widths = [max(len(row[i]) for row in self.rows)
for i in range(columns)]
- lines = [
- "|".join([cell.ljust(col_width)
- for cell, col_width in zip(row, col_widths)])
+ lines = [" | ".join([cell.ljust(col_width)
+ for cell, col_width in zip(row, col_widths)])
for row in self.rows]
- lines[1:1] = ["+".join("-"*col_width
- for col_width in col_widths)]
+ lines[1:1] = ["+".join("-" * (col_width + 1 + (i > 0))
+ for i, col_width in enumerate(col_widths))]
+
return "\n".join(lines)
def latex(self, skip_lines=0, hline_after=None):
@@ -2182,7 +2193,11 @@
# feature for interactive use, do not do it unless there is (weak)
# evidence of interactive use.
import sys
- use_late_start_logging = sys.stdin.isatty()
+ if sys.stdin is None:
+ # Can happen, e.g., if pudb is controlling the console.
+ use_late_start_logging = False
+ else:
+ use_late_start_logging = sys.stdin.isatty()
import os
if os.environ.get("PYTOOLS_LOG_NO_THREADS", ""):
@@ -2274,6 +2289,59 @@
# }}}
+
+# {{{ sorting in natural order
+
+def natorder(item):
+ """Return a key for natural order string comparison.
+
+ See :func:`natsorted`.
+
+ .. versionadded:: 2020.1
+ """
+ import re
+ result = []
+ for (int_val, string_val) in re.findall(r"(\d+)|(\D+)", item):
+ if int_val:
+ result.append(int(int_val))
+ # Tie-breaker in case of leading zeros in *int_val*. Longer values
+ # compare smaller to preserve order of numbers in decimal notation,
+ # e.g., "1.001" < "1.01"
+ # (cf. https://github.com/sourcefrog/natsort)
+ result.append(-len(int_val))
+ else:
+ result.append(string_val)
+ return result
+
+
+def natsorted(iterable, key=None, reverse=False):
+ """Sort using natural order [1]_, as opposed to lexicographic order.
+
+ Example::
+
+ >>> sorted(["_10", "_1", "_9"]) == ["_1", "_10", "_9"]
+ True
+ >>> natsorted(["_10", "_1", "_9"]) == ["_1", "_9", "_10"]
+ True
+
+ :arg iterable: an iterable to be sorted. It must only have strings, unless
+ *key* is specified.
+ :arg key: if provided, a key function that returns strings for ordering
+ using natural order.
+ :arg reverse: if *True*, sorts in descending order.
+
+ :returns: a sorted list
+
+ .. [1] https://en.wikipedia.org/wiki/Natural_sort_order
+
+ .. versionadded:: 2020.1
+ """
+ if key is None:
+ key = lambda x: x
+ return sorted(iterable, key=lambda y: natorder(key(y)), reverse=reverse)
+
+# }}}
+
def _test():
import doctest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/pytools/convergence.py
new/pytools-2020.1/pytools/convergence.py
--- old/pytools-2019.1.1/pytools/convergence.py 2015-10-25 20:25:53.000000000
+0100
+++ new/pytools-2020.1/pytools/convergence.py 2019-10-02 00:43:52.000000000
+0200
@@ -50,7 +50,13 @@
def max_error(self):
return max(err for absc, err in self.history)
- def pretty_print(self, abscissa_label="h", error_label="Error",
gliding_mean=2):
+ def pretty_print(self,
+ abscissa_label="h",
+ error_label="Error",
+ gliding_mean=2,
+ abscissa_format="%s",
+ error_format="%s",
+ eoc_format="%s"):
from pytools import Table
tbl = Table()
@@ -58,14 +64,18 @@
gm_eoc = self.estimate_order_of_convergence(gliding_mean)
for i, (absc, err) in enumerate(self.history):
+ absc_str = abscissa_format % absc
+ err_str = error_format % err
if i < gliding_mean-1:
- tbl.add_row((str(absc), str(err), ""))
+ eoc_str = ""
else:
- tbl.add_row((str(absc), str(err), str(gm_eoc[i-gliding_mean+1,
1])))
+ eoc_str = eoc_format % (gm_eoc[i - gliding_mean + 1, 1])
+
+ tbl.add_row((absc_str, err_str, eoc_str))
if len(self.history) > 1:
- return str(tbl) + "\n\nOverall EOC: %s" \
- % self.estimate_order_of_convergence()[0, 1]
+ return "%s\n\nOverall EOC: %s" % (str(tbl),
+ self.estimate_order_of_convergence()[0, 1])
else:
return str(tbl)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/pytools/debug.py
new/pytools-2020.1/pytools/debug.py
--- old/pytools-2019.1.1/pytools/debug.py 2019-01-21 04:23:24.000000000
+0100
+++ new/pytools-2020.1/pytools/debug.py 2019-10-02 00:43:52.000000000 +0200
@@ -1,7 +1,9 @@
from __future__ import absolute_import, print_function
+import sys
import six
from six.moves import input
+
from pytools import memoize
@@ -216,4 +218,27 @@
# }}}
+
+# {{{ estimate memory usage
+
+def estimate_memory_usage(root, seen_ids=None):
+ if seen_ids is None:
+ seen_ids = set()
+
+ id_root = id(root)
+ if id_root in seen_ids:
+ return 0
+
+ seen_ids.add(id_root)
+
+ result = sys.getsizeof(root)
+
+ from gc import get_referents
+ for ref in get_referents(root):
+ result += estimate_memory_usage(ref, seen_ids=seen_ids)
+
+ return result
+
+# }}}
+
# vim: foldmethod=marker
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/pytools/prefork.py
new/pytools-2020.1/pytools/prefork.py
--- old/pytools-2019.1.1/pytools/prefork.py 2019-01-21 04:23:24.000000000
+0100
+++ new/pytools-2020.1/pytools/prefork.py 2019-10-22 22:42:36.000000000
+0200
@@ -53,7 +53,7 @@
if error_on_nonzero and popen.returncode:
raise ExecError("status %d invoking '%s': %s"
% (popen.returncode, " ".join(cmdline),
- stderr_data))
+ stderr_data.decode("utf-8",
errors="replace")))
return popen.returncode, stdout_data, stderr_data
except OSError as e:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/pytools/py_codegen.py
new/pytools-2020.1/pytools/py_codegen.py
--- old/pytools-2019.1.1/pytools/py_codegen.py 2019-01-21 04:23:24.000000000
+0100
+++ new/pytools-2020.1/pytools/py_codegen.py 2019-10-02 00:43:52.000000000
+0200
@@ -23,12 +23,19 @@
"""
import marshal
-import imp
from types import FunctionType, ModuleType
import six
+try:
+ from importlib.util import MAGIC_NUMBER as BYTECODE_VERSION
+except ImportError:
+ # Pre-3.4
+ import imp
+ BYTECODE_VERSION = imp.get_magic()
+
+
# loosely based on
# http://effbot.org/zone/python-code-generator.htm
@@ -140,7 +147,7 @@
elif k not in _empty_module_dict:
nondefault_globals[k] = v
- return (1, imp.get_magic(), functions, modules, nondefault_globals)
+ return (1, BYTECODE_VERSION, functions, modules, nondefault_globals)
def __setstate__(self, obj):
if obj[0] == 0:
@@ -151,10 +158,10 @@
else:
raise ValueError("unknown version of PicklableModule")
- if magic != imp.get_magic():
+ if magic != BYTECODE_VERSION:
raise ValueError("cannot unpickle function binary: "
- "incorrect magic value (got: %s, expected: %s)"
- % (magic, imp.get_magic()))
+ "incorrect magic value (got: %r, expected: %r)"
+ % (magic, BYTECODE_VERSION))
mod_globals = _empty_module_dict.copy()
mod_globals.update(nondefault_globals)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/pytools/version.py
new/pytools-2020.1/pytools/version.py
--- old/pytools-2019.1.1/pytools/version.py 2019-04-25 19:14:37.000000000
+0200
+++ new/pytools-2020.1/pytools/version.py 2020-01-12 17:44:21.000000000
+0100
@@ -1,3 +1,3 @@
-VERSION = (2019, 1, 1)
+VERSION = (2020, 1)
VERSION_STATUS = ""
VERSION_TEXT = ".".join(str(x) for x in VERSION) + VERSION_STATUS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/pytools.egg-info/PKG-INFO
new/pytools-2020.1/pytools.egg-info/PKG-INFO
--- old/pytools-2019.1.1/pytools.egg-info/PKG-INFO 2019-04-25
19:15:05.000000000 +0200
+++ new/pytools-2020.1/pytools.egg-info/PKG-INFO 2020-01-15
01:23:35.000000000 +0100
@@ -1,12 +1,25 @@
Metadata-Version: 1.1
Name: pytools
-Version: 2019.1.1
+Version: 2020.1
Summary: A collection of tools for Python
Home-page: http://pypi.python.org/pypi/pytools
Author: Andreas Kloeckner
Author-email: [email protected]
License: MIT
-Description: Pytools is a big bag of things that are "missing" from the Python
standard
+Description: Pytools: Lots of Little Utilities
+ =================================
+
+ .. image::
https://gitlab.tiker.net/inducer/pytools/badges/master/pipeline.svg
+ :alt: Gitlab Build Status
+ :target: https://gitlab.tiker.net/inducer/pytools/commits/master
+ .. image::
https://dev.azure.com/ak-spam/inducer/_apis/build/status/inducer.pytools?branchName=master
+ :alt: Azure Build Status
+ :target:
https://dev.azure.com/ak-spam/inducer/_build/latest?definitionId=2&branchName=master
+ .. image:: https://badge.fury.io/py/pytools.png
+ :alt: Python Package Index Release Page
+ :target: https://pypi.org/project/pytools/
+
+ Pytools is a big bag of things that are "missing" from the Python
standard
library. This is mainly a dependency of my other software packages,
and is
probably of little interest to you unless you use those. If you're
curious
nonetheless, here's what's on offer:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytools-2019.1.1/test/test_pytools.py
new/pytools-2020.1/test/test_pytools.py
--- old/pytools-2019.1.1/test/test_pytools.py 2019-04-25 19:14:13.000000000
+0200
+++ new/pytools-2020.1/test/test_pytools.py 2020-01-12 17:44:21.000000000
+0100
@@ -170,6 +170,24 @@
assert next(gen) == (7, "b_6")
+def test_cartesian_product():
+ from pytools import cartesian_product
+
+ expected_outputs = [
+ (0, 2, 4),
+ (0, 2, 5),
+ (0, 3, 4),
+ (0, 3, 5),
+ (1, 2, 4),
+ (1, 2, 5),
+ (1, 3, 4),
+ (1, 3, 5),
+ ]
+
+ for i, output in enumerate(cartesian_product([0, 1], [2, 3], [4, 5])):
+ assert output == expected_outputs[i]
+
+
def test_find_module_git_revision():
import pytools
print(pytools.find_module_git_revision(pytools.__file__, n_levels_up=1))
@@ -199,6 +217,50 @@
sleep(0.3)
+def test_table():
+ import math
+ from pytools import Table
+
+ tbl = Table()
+ tbl.add_row(("i", "i^2", "i^3", "sqrt(i)"))
+
+ for i in range(8):
+ tbl.add_row((i, i ** 2, i ** 3, math.sqrt(i)))
+
+ print(tbl)
+ print()
+ print(tbl.latex())
+
+
+def test_eoc():
+ from pytools.convergence import EOCRecorder
+ eoc = EOCRecorder()
+
+ for i in range(1, 8):
+ eoc.add_data_point(1.0 / i, 10 ** (-i))
+
+ p = eoc.pretty_print()
+ print(p)
+ print()
+
+ p = eoc.pretty_print(
+ abscissa_format="%.5e",
+ error_format="%.5e",
+ eoc_format="%5.2f")
+ print(p)
+
+
+def test_natsorted():
+ from pytools import natsorted, natorder
+
+ assert natorder("1.001") < natorder("1.01")
+
+ assert natsorted(["x10", "x1", "x9"]) == ["x1", "x9", "x10"]
+ assert natsorted(map(str, range(100))) == list(map(str, range(100)))
+ assert natsorted(["x10", "x1", "x9"], reverse=True) == ["x10", "x9", "x1"]
+ assert natsorted([10, 1, 9], key=lambda d: "x%d" % d) == [1, 9, 10]
+
+
if __name__ == "__main__":
if len(sys.argv) > 1:
exec(sys.argv[1])