From 893e0cccf0b9b665af4161fe5dc20b41c4711506 Mon Sep 17 00:00:00 2001 From: Aryaz Eghbali Date: Fri, 30 Aug 2024 13:25:12 +0200 Subject: [PATCH] Do not check filters for dunder methods --- src/dynapyt/runtime.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/dynapyt/runtime.py b/src/dynapyt/runtime.py index 34a8abf..19893f4 100644 --- a/src/dynapyt/runtime.py +++ b/src/dynapyt/runtime.py @@ -157,17 +157,20 @@ def call_if_exists(self, f, *args): func = self.analysis_func(analysis, f) if func is None: continue - args_for_filter = [] - for arg in args[2:]: - if type(arg) is list or type(arg) is dict: - pass - else: - try: - hash(arg) - args_for_filter.append(arg) - except: + if f.startswith("__") and f.endswith("__"): + is_filtered = False + else: + args_for_filter = [] + for arg in args[2:]: + if type(arg) is list or type(arg) is dict: pass - is_filtered = self.filtered(func, f, tuple(args_for_filter)) + else: + try: + hash(arg) + args_for_filter.append(arg) + except: + pass + is_filtered = self.filtered(func, f, tuple(args_for_filter)) if len(args) < 2 or not is_filtered: return_value = func(*args)