Path 1: 23293 calls (0.97)

FunctionDef (14330) AssignName (4866) Const (2469) ClassDef (760) EmptyNode (657) Module (129) ImportFrom (68) Import (10) Arguments (4)

tuple (12074) (None, None) (11219)

1def get_callbacks(self, node: nodes.NodeNG) -> _CallbackTupleT:
2        """Get callbacks from handler for the visited node."""
3        klass = node.__class__
4        methods = self._cache.get(klass)
5        if methods is None:
6            kid = klass.__name__.lower()
7            e_method = getattr(
8                self, f"visit_{kid}", getattr(self, "visit_default", None)
9            )
10            l_method = getattr(
11                self, f"leave_{kid}", getattr(self, "leave_default", None)
12            )
13            self._cache[klass] = (e_method, l_method)
14        else:
15            e_method, l_method = methods
16        return e_method, l_method
            

Path 2: 631 calls (0.03)

ClassDef (73) Const (73) FunctionDef (73) EmptyNode (73) AssignName (73) Arguments (73) Module (56) ImportFrom (52) Property (45) Project (38)

(None, None) (328) tuple (303)

1def get_callbacks(self, node: nodes.NodeNG) -> _CallbackTupleT:
2        """Get callbacks from handler for the visited node."""
3        klass = node.__class__
4        methods = self._cache.get(klass)
5        if methods is None:
6            kid = klass.__name__.lower()
7            e_method = getattr(
8                self, f"visit_{kid}", getattr(self, "visit_default", None)
9            )
10            l_method = getattr(
11                self, f"leave_{kid}", getattr(self, "leave_default", None)
12            )
13            self._cache[klass] = (e_method, l_method)
14        else:
15            e_method, l_method = methods
16        return e_method, l_method