MCPcopy Create free account
hub / github.com/idank/explainshell / depthchecker

Class depthchecker

tests/test_matcher.py:807–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805 m.match()
806
807 class depthchecker(bashlex.ast.nodevisitor):
808 def __init__(self):
809 self.depth = 0
810 self.maxdepth = 0
811
812 def visitnode(self, node):
813 if "substitution" in node.kind:
814 self.depth += 1
815 self.maxdepth = max(self.maxdepth, self.depth)
816
817 def visitendnode(self, node):
818 if "substitution" in node.kind:
819 self.depth -= 1
820
821 v = depthchecker()
822 v.visit(m.ast)

Callers 1

test_expansion_limitMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_expansion_limitMethod · 0.68