From 9f2d2f0cb42b1bb6e5d87d01552f23b9670ec02a Mon Sep 17 00:00:00 2001 From: Nicholas Cilfone Date: Tue, 11 Jan 2022 13:03:34 -0500 Subject: [PATCH] fix bug where equality was checking using is (which checks memory loc) which prevents class overloading and re-mapping. Switched to a simple module + class name mapping as those should still be unique (#202) --- spock/graph.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spock/graph.py b/spock/graph.py index 29804174..4f8142d1 100644 --- a/spock/graph.py +++ b/spock/graph.py @@ -57,11 +57,12 @@ def _build(self): """ # Build a dictionary of all nodes (base spock classes) nodes = {val: [] for val in self._input_classes} + node_names = [f"{k.__module__}.{k.__name__}" for k in nodes.keys()] # Iterate thorough all of the base spock classes to get the dependencies and reverse dependencies for input_class in self._input_classes: dep_classes = self._find_all_spock_classes(input_class) for v in dep_classes: - if v not in nodes: + if f"{v.__module__}.{v.__name__}" not in node_names: raise ValueError( f"Missing @spock decorated class -- `{v.__name__}` was not passed as an *arg to " f"ConfigArgBuilder"