Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
krstf1 authored Jun 24, 2024
1 parent ac372cf commit 265349a
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions lizard_ext/lizardnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,32 @@ def get_loop_status(self):
return self.current_function.bracket_loop


branch_coverage = {
"has_func_branch": False,
"no_func_branch": False
}

def print_coverage():
has_func_hit = branch_coverage["has_func_branch"]
no_func_hit = branch_coverage["no_func_branch"]
print(f"Branch 'has_func_branch' was {'hit' if has_func_hit else 'not hit'}")
print(f"Branch 'no_func_branch' was {'hit' if no_func_hit else 'not hit'}")

def get_method(cls, name):
""" python3 doesn't need the __func__ to get the func of the
method.
"""
""" python3 doesn't need the __func__ to get the func of the method. """
method = getattr(cls, name)
if hasattr(method, "__func__"):
branch_coverage["has_func_branch"] = True
method = method.__func__
else:
branch_coverage["no_func_branch"] = True
return method






def patch(frm, accept_class):
for method in [k for k in frm.__dict__ if not k.startswith("_")]:
setattr(accept_class, method, get_method(frm, method))
Expand All @@ -131,3 +147,5 @@ def _init_nesting_depth_data(self, *_):

patch(NDFileInfoAddition, FileInfoBuilder)
patch_append_method(_init_nesting_depth_data, FunctionInfo, "__init__")


0 comments on commit 265349a

Please sign in to comment.