From 0050142424f91d3ccf48fa55f08572dc461fb82b Mon Sep 17 00:00:00 2001 From: Alexandru Savulescu Date: Tue, 1 Feb 2022 16:29:03 +0100 Subject: [PATCH] NEURON 8.0.x RXD node: backward compatible Callable --- share/lib/python/neuron/rxd/node.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/share/lib/python/neuron/rxd/node.py b/share/lib/python/neuron/rxd/node.py index 84ae2855f3..2cdaa20563 100644 --- a/share/lib/python/neuron/rxd/node.py +++ b/share/lib/python/neuron/rxd/node.py @@ -7,7 +7,13 @@ from .rxdException import RxDException import warnings import ctypes -import collections + +# For 8.0.x release, keep backward compat with older python versions +try: + from collections.abc import Callable +except ImportError: + from collections import Callable + # function to change extracellular diffusion set_diffusion = nrn_dll_sym("set_diffusion") @@ -313,7 +319,7 @@ def include_flux(self, *args, **kwargs): source[0] except: raise RxDException("HocObject must be a pointer") - elif len(args) == 1 and isinstance(args[0], collections.Callable): + elif len(args) == 1 and isinstance(args[0], Callable): flux_type = 2 source = args[0] warnings.warn(