Skip to content

Commit

Permalink
Merge pull request #75 from sola-st/dylin
Browse files Browse the repository at this point in the history
Fixed filters
  • Loading branch information
AryazE authored Sep 11, 2024
2 parents 81adfc0 + c339b08 commit aae6015
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/dynapyt/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ def set_coverage(self, coverage_dir: str):
self.coverage_path.unlink()

@lru_cache(maxsize=128)
def filtered(self, func, f, args):
docs = func.__doc__
if docs is None or START not in docs:
return False
def filtered(self, docs, args):
if len(args) > 0:
sub_args = args
else:
Expand Down Expand Up @@ -134,20 +131,27 @@ def call_if_exists(self, f, *args):
func = self.analysis_func(analysis, f)
if func is None:
continue
if f.startswith("__") and f.endswith("__"):
docs = func.__doc__
if docs is None or START not in docs:
is_filtered = False
elif 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
else:
elif (
type(arg) is type(print)
or type(arg) is type(snake)
or type(arg) is type(self.set_coverage)
):
try:
hash(arg)
args_for_filter.append(arg)
except:
pass
is_filtered = self.filtered(func, f, tuple(args_for_filter))
is_filtered = self.filtered(docs, tuple(args_for_filter))

if len(args) < 2 or not is_filtered:
return_value = func(*args)
Expand Down

0 comments on commit aae6015

Please sign in to comment.