[lasagne] 08/17: Use inspect.signature instead of inspect.getargspec if possible

Stephen Sinclair sinclairs-guest at moszumanska.debian.org
Thu Nov 2 23:24:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

sinclairs-guest pushed a commit to branch master
in repository lasagne.

commit d663c1de9fd04ecfdf2c287a690e97e104902c6a
Author: Ole Streicher <olebole at debian.org>
Date:   Wed Feb 8 16:14:41 2017 +0100

    Use inspect.signature instead of inspect.getargspec if possible
    
    Closes: #834910
---
 debian/changelog                       |  7 ++++++
 debian/patches/remove-deprecated.patch | 41 ++++++++++++++++++++++++++++++++++
 debian/patches/series                  |  1 +
 debian/rules                           |  2 +-
 4 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 4031946..e22634e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+lasagne (0.1+git20160728.8b66737-2) UNRELEASED; urgency=medium
+
+  * Use inspect.signature instead of inspect.getargspec if possible
+    (Closes: #834910)
+
+ -- Ole Streicher <olebole at debian.org>  Wed, 08 Feb 2017 16:10:28 +0100
+
 lasagne (0.1+git20160728.8b66737-1) unstable; urgency=medium
 
   * Initial release (Closes: #818641).
diff --git a/debian/patches/remove-deprecated.patch b/debian/patches/remove-deprecated.patch
new file mode 100644
index 0000000..e91bc88
--- /dev/null
+++ b/debian/patches/remove-deprecated.patch
@@ -0,0 +1,41 @@
+Author: Ole Streicher <olebole at debian.org>
+Description: Use inspect.signature instead of inspect.getargspec if possible
+ inspect.getargspec is deprectated in Python 3.5 and causes a warning.
+ The deprecation warning caused failures in test_get_output_with_unused_kwarg and
+ test_get_output_with_no_unused_kwarg.
+Bug: https://bugs.debian.org/834910 
+--- a/lasagne/layers/helper.py
++++ b/lasagne/layers/helper.py
+@@ -1,6 +1,6 @@
+ from collections import deque
+ from difflib import get_close_matches
+-from inspect import getargspec
++import inspect
+ from itertools import chain
+ from warnings import warn
+ 
+@@ -9,6 +9,15 @@
+ 
+ from .. import utils
+ 
++def getargs(callable):
++    try:
++        pars = inspect.signature(callable).parameters
++        return (list(pars.keys()),
++                tuple(p.default for p in pars.values()
++                      if p.default is not p.empty))
++    except AttributeError:
++        name, _, _, defaults = inspect.getargspec(callable)
++        return (name, defaults)
+ 
+ __all__ = [
+     "get_all_layers",
+@@ -190,7 +199,7 @@
+                                  % layer)
+             all_outputs[layer] = layer.get_output_for(layer_inputs, **kwargs)
+             try:
+-                names, _, _, defaults = getargspec(layer.get_output_for)
++                names, defaults = getargs(layer.get_output_for)
+             except TypeError:
+                 # If introspection is not possible, skip it
+                 pass
diff --git a/debian/patches/series b/debian/patches/series
index 809981b..a735f0e 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 pytest-no-cov-pep8.patch
 use-mathjax-package.patch
+remove-deprecated.patch
diff --git a/debian/rules b/debian/rules
index 25a73f1..026b340 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,7 +8,7 @@ export THEANO_FLAGS=base_compiledir='.pybuild',device=cpu
 	dh $@ --with python2,python3,sphinxdoc --buildsystem=pybuild
 
 override_dh_auto_test:
-	PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="{interpreter} -m pytest -v -rs lasagne/" dh_auto_test || true # 2 fails with Python 3.5 remain
+	PYBUILD_SYSTEM=custom PYBUILD_TEST_ARGS="{interpreter} -m pytest -v -rs lasagne/" dh_auto_test
 
 override_dh_auto_install:
 	dh_auto_install

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/lasagne.git



More information about the debian-science-commits mailing list