[Python-modules-commits] r27282 - in packages/python-networkx/trunk/debian (5 files)
morph at users.alioth.debian.org
morph at users.alioth.debian.org
Sat Jan 18 11:16:53 UTC 2014
Date: Saturday, January 18, 2014 @ 11:16:52
Author: morph
Revision: 27282
* debian/patch/{50, 55, 60}*
- backport patches
Added:
packages/python-networkx/trunk/debian/patches/50_force_ordering_in_dict_to_numpy_array_functions.patch
packages/python-networkx/trunk/debian/patches/55_fixups_to_numpy_array_functions_patch.patch
packages/python-networkx/trunk/debian/patches/60_fix_tests_failure_due_to_py3.3_hash_randomization.patch
Modified:
packages/python-networkx/trunk/debian/changelog
packages/python-networkx/trunk/debian/patches/series
Modified: packages/python-networkx/trunk/debian/changelog
===================================================================
--- packages/python-networkx/trunk/debian/changelog 2014-01-18 11:13:55 UTC (rev 27281)
+++ packages/python-networkx/trunk/debian/changelog 2014-01-18 11:16:52 UTC (rev 27282)
@@ -11,8 +11,10 @@
- added decorator copyright notice
* debian/patches/*
- refreshed patches
+ * debian/patch/{50, 55, 60}*
+ - backport patches
- -- Sandro Tosi <morph at debian.org> Sun, 12 Jan 2014 22:35:04 +0100
+ -- Sandro Tosi <morph at debian.org> Sat, 18 Jan 2014 12:16:32 +0100
python-networkx (1.7-2) experimental; urgency=low
Added: packages/python-networkx/trunk/debian/patches/50_force_ordering_in_dict_to_numpy_array_functions.patch
===================================================================
--- packages/python-networkx/trunk/debian/patches/50_force_ordering_in_dict_to_numpy_array_functions.patch (rev 0)
+++ packages/python-networkx/trunk/debian/patches/50_force_ordering_in_dict_to_numpy_array_functions.patch 2014-01-18 11:16:52 UTC (rev 27282)
@@ -0,0 +1,91 @@
+From ee8df352ae88299f1e9c7bd74db954ff06d03770 Mon Sep 17 00:00:00 2001
+From: Aric Hagberg <aric.hagberg at gmail.com>
+Date: Sat, 9 Nov 2013 09:43:26 -0700
+Subject: [PATCH] Force ordering in dict_to_numpy_array functions
+
+Force ordering to be that of the provided mapping dictionary or else create a mapping using the input data dictionary ordering.
+
+Fix tests to determine ordering.
+---
+ networkx/utils/misc.py | 22 +++++++++++++++-------
+ networkx/utils/tests/test_misc.py | 20 +++++++++++++++-----
+ 2 files changed, 30 insertions(+), 12 deletions(-)
+
+--- a/networkx/utils/misc.py
++++ b/networkx/utils/misc.py
+@@ -125,11 +125,19 @@ def dict_to_numpy_array2(d,mapping=None)
+ mapping=dict(zip(s,range(len(s))))
+ n=len(mapping)
+ a = numpy.zeros((n, n))
+- for k1, row in d.items():
+- for k2, value in row.items():
+- i=mapping[k1]
+- j=mapping[k2]
+- a[i,j] = value
++ print(mapping)
++ for k1, i in mapping.items():
++# for k1, row in d.items():
++ for k2, j in mapping.items():
++ try:
++ a[i,j]=d[k1][k2]
++ except KeyError:
++ pass
++# for k2, value in row.items():
++# a[i,j] = d[k1][k2]
++# i=mapping[k1]
++# j=mapping[k2]
++# a[i,j] = value
+ return a
+
+ def dict_to_numpy_array1(d,mapping=None):
+@@ -145,7 +153,7 @@ def dict_to_numpy_array1(d,mapping=None)
+ mapping = dict(zip(s,range(len(s))))
+ n = len(mapping)
+ a = numpy.zeros(n)
+- for k1, value in d.items():
++ for k1,i in mapping.items():
+ i = mapping[k1]
+- a[i] = value
++ a[i] = d[k1]
+ return a
+--- a/networkx/utils/tests/test_misc.py
++++ b/networkx/utils/tests/test_misc.py
+@@ -49,7 +49,7 @@ class TestNumpyArray(object):
+ def test_dict_to_numpy_array1(self):
+ d = {'a':1,'b':2}
+ a = dict_to_numpy_array1(d)
+- assert_equal(a, numpy.array([1,2]))
++ assert_equal(a, numpy.array(list(d.values())))
+ a = dict_to_numpy_array1(d, mapping = {'b':0,'a':1})
+ assert_equal(a, numpy.array([2,1]))
+
+@@ -57,7 +57,12 @@ class TestNumpyArray(object):
+ d = {'a': {'a':1,'b':2},
+ 'b': {'a':10,'b':20}}
+ a = dict_to_numpy_array(d)
+- assert_equal(a, numpy.array([[1,2],[10,20]]))
++ if list(d.keys())[0] == 'a':
++ assert_equal(a, numpy.array([[1,2],[10,20]]))
++ elif list(d.keys())[0] == 'b':
++ assert_equal(a, numpy.array([[20,10],[2,1]]))
++ else:
++ raise
+ a = dict_to_numpy_array2(d, mapping = {'b':0,'a':1})
+ assert_equal(a, numpy.array([[20,10],[2,1]]))
+
+@@ -66,7 +71,12 @@ class TestNumpyArray(object):
+ d = {'a': {'a':1,'b':2},
+ 'b': {'a':10,'b':20}}
+ a = dict_to_numpy_array(d)
+- assert_equal(a, numpy.array([[1,2],[10,20]]))
++ if list(d.keys())[0] == 'a':
++ assert_equal(a, numpy.array([[1,2],[10,20]]))
++ elif list(d.keys())[0] == 'b':
++ assert_equal(a, numpy.array([[20,10],[2,1]]))
++ else:
++ raise
+ d = {'a':1,'b':2}
+- a = dict_to_numpy_array1(d)
+- assert_equal(a, numpy.array([1,2]))
++ a = dict_to_numpy_array(d)
++ assert_equal(a, numpy.array(list(d.values())))
Added: packages/python-networkx/trunk/debian/patches/55_fixups_to_numpy_array_functions_patch.patch
===================================================================
--- packages/python-networkx/trunk/debian/patches/55_fixups_to_numpy_array_functions_patch.patch (rev 0)
+++ packages/python-networkx/trunk/debian/patches/55_fixups_to_numpy_array_functions_patch.patch 2014-01-18 11:16:52 UTC (rev 27282)
@@ -0,0 +1,32 @@
+From 25086b5bb00f0c879749de60bef610f37c6625a3 Mon Sep 17 00:00:00 2001
+From: Aric Hagberg <aric.hagberg at gmail.com>
+Date: Sat, 9 Nov 2013 10:56:03 -0700
+Subject: [PATCH] Clean up the mess I left in #1006
+
+Remove a print statement and some commented out code.
+---
+ networkx/utils/misc.py | 7 -------
+ 1 file changed, 7 deletions(-)
+
+--- a/networkx/utils/misc.py
++++ b/networkx/utils/misc.py
+@@ -125,19 +125,12 @@ def dict_to_numpy_array2(d,mapping=None)
+ mapping=dict(zip(s,range(len(s))))
+ n=len(mapping)
+ a = numpy.zeros((n, n))
+- print(mapping)
+ for k1, i in mapping.items():
+-# for k1, row in d.items():
+ for k2, j in mapping.items():
+ try:
+ a[i,j]=d[k1][k2]
+ except KeyError:
+ pass
+-# for k2, value in row.items():
+-# a[i,j] = d[k1][k2]
+-# i=mapping[k1]
+-# j=mapping[k2]
+-# a[i,j] = value
+ return a
+
+ def dict_to_numpy_array1(d,mapping=None):
Added: packages/python-networkx/trunk/debian/patches/60_fix_tests_failure_due_to_py3.3_hash_randomization.patch
===================================================================
--- packages/python-networkx/trunk/debian/patches/60_fix_tests_failure_due_to_py3.3_hash_randomization.patch (rev 0)
+++ packages/python-networkx/trunk/debian/patches/60_fix_tests_failure_due_to_py3.3_hash_randomization.patch 2014-01-18 11:16:52 UTC (rev 27282)
@@ -0,0 +1,38 @@
+From 8564c5e4aecfbbaa68965d5f684e705c6070e464 Mon Sep 17 00:00:00 2001
+From: Aric Hagberg <aric.hagberg at gmail.com>
+Date: Wed, 23 Oct 2013 20:45:59 -0600
+Subject: [PATCH] Fix tests that fail due to hash randomization
+
+---
+ networkx/algorithms/assortativity/correlation.py | 2 +-
+ networkx/convert.py | 8 ++++++--
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+--- a/networkx/algorithms/assortativity/correlation.py
++++ b/networkx/algorithms/assortativity/correlation.py
+@@ -115,7 +115,7 @@ def degree_pearson_correlation_coefficie
+ --------
+ >>> G=nx.path_graph(4)
+ >>> r=nx.degree_pearson_correlation_coefficient(G)
+- >>> r
++ >>> print("%3.1f"%r)
+ -0.5
+
+ Notes
+--- a/networkx/convert.py
++++ b/networkx/convert.py
+@@ -568,8 +568,12 @@ def from_numpy_matrix(A,create_using=Non
+ >>> dt=[('weight',float),('cost',int)]
+ >>> A=numpy.matrix([[(1.0,2)]],dtype=dt)
+ >>> G=nx.from_numpy_matrix(A)
+- >>> G.edges(data=True)
+- [(0, 0, {'cost': 2, 'weight': 1.0})]
++ >>> G.edges()
++ [(0, 0)]
++ >>> G[0][0]['cost']
++ 2
++ >>> G[0][0]['weight']
++ 1.0
+ """
+ kind_to_python_type={'f':float,
+ 'i':int,
Modified: packages/python-networkx/trunk/debian/patches/series
===================================================================
--- packages/python-networkx/trunk/debian/patches/series 2014-01-18 11:13:55 UTC (rev 27281)
+++ packages/python-networkx/trunk/debian/patches/series 2014-01-18 11:16:52 UTC (rev 27282)
@@ -2,3 +2,6 @@
20_example_dirs_remove
30_use_local_objects.inv
40_no_setuptools_in_requires.txt
+50_force_ordering_in_dict_to_numpy_array_functions.patch
+55_fixups_to_numpy_array_functions_patch.patch
+60_fix_tests_failure_due_to_py3.3_hash_randomization.patch
More information about the Python-modules-commits
mailing list