From 7c385eb6a0225ae6e65de07522a5a53c0dad39f1 Mon Sep 17 00:00:00 2001 From: Fanxin Sun Date: Wed, 5 Aug 2026 11:48:36 +0800 Subject: [PATCH] fix: make dispatch chains in numba object backend exhaustive Add terminal `else: raise AssertionError` branches to the dimension/groupname dispatch chains flagged by pylint E0606 (possibly-used-before-assignment). The chains are exhaustive at runtime (dimensions are always 2, 3, or 4, and isclose validates matching dimensions upstream), so the new branches are unreachable guards, matching the existing bare-AssertionError convention at the top of the module. Fixes #512 --- src/vector/backends/_numba_object.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/vector/backends/_numba_object.py b/src/vector/backends/_numba_object.py index 5e744c5e..529373f5 100644 --- a/src/vector/backends/_numba_object.py +++ b/src/vector/backends/_numba_object.py @@ -1431,6 +1431,9 @@ def overloader(v1, v2): coord23 = getcoord1[numba_ltype(v2)] coord24 = getcoord1[numba_ttype(v2)] + else: + raise AssertionError + if groupname == "planar": signature = (numba_aztype(v1), numba_aztype(v2)) @@ -1452,6 +1455,9 @@ def overloader(v1, v2): numba_ttype(v2), ) + else: + raise AssertionError + function, *returns = _from_signature( groupname + "." + methodname, numba_modules[groupname][methodname], @@ -1639,6 +1645,9 @@ def overloader_impl(v1, v2, tolerance=1e-5): # pragma: no cover coord22 = getcoord2[numba_aztype(v2)] coord23 = getcoord1[numba_ltype(v2)] + else: + raise AssertionError + function, *_ = _from_signature( groupname + "." + methodname, numba_modules[groupname][methodname], @@ -1788,6 +1797,9 @@ def overloader_impl(v1, v2, rtol=1e-05, atol=1e-08, equal_nan=False): coord24(v2), ) + else: + raise AssertionError + return overloader_impl @@ -1898,6 +1910,9 @@ def overloader_impl(v, obj): ) return instance_class(azcoords(out1, out2), v.longitudinal, v.temporal) + else: + raise AssertionError + return overloader_impl