From 82bf183a28ae504aee216d576832a79ab4a5df46 Mon Sep 17 00:00:00 2001 From: Adrien Berchet Date: Wed, 17 Apr 2024 19:28:41 +0200 Subject: [PATCH 1/2] Fix NeuriteType for Python 3.12.3 --- neurom/core/types.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/neurom/core/types.py b/neurom/core/types.py index e060ed2a..6a027c5a 100644 --- a/neurom/core/types.py +++ b/neurom/core/types.py @@ -81,8 +81,12 @@ def __call__(cls, value, names=None, *, module=None, qualname=None, type=None, s value = _int_or_tuple(value) except ValueError: pass + kwargs = {} + if names is not None: + # Keep default value of EnumMeta for Python>=3.12.3 + kwargs["names"] = names return super().__call__( - value, names=names, module=module, qualname=qualname, type=type, start=start + value, module=module, qualname=qualname, type=type, start=start, **kwargs ) From c1bce5ba9fab235c57178ab1c09d965d788aa5f7 Mon Sep 17 00:00:00 2001 From: Adrien Berchet Date: Wed, 17 Apr 2024 19:42:18 +0200 Subject: [PATCH 2/2] Coverage --- neurom/core/types.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neurom/core/types.py b/neurom/core/types.py index 6a027c5a..d5387460 100644 --- a/neurom/core/types.py +++ b/neurom/core/types.py @@ -84,7 +84,7 @@ def __call__(cls, value, names=None, *, module=None, qualname=None, type=None, s kwargs = {} if names is not None: # Keep default value of EnumMeta for Python>=3.12.3 - kwargs["names"] = names + kwargs["names"] = names # pragma: no cover return super().__call__( value, module=module, qualname=qualname, type=type, start=start, **kwargs )