MCPcopy Create free account
hub / github.com/SplootCode/splootcode / SplootCapture

Class SplootCapture

python/executor.py:794–902  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

792
793
794class SplootCapture:
795 def __init__(self):
796 self.root = CaptureContext("PYTHON_FILE", "body")
797 self.stack = [self.root]
798 self.detachedFrames = {}
799 self.detachedFramesCount = {}
800 self.detachedFramesException = {}
801 self.sideEffects = []
802 self.lastException = None
803
804 def func(self, func_id):
805 self.detachedFrames.setdefault(func_id, [])
806 self.detachedFramesCount.setdefault(func_id, 0)
807 frames = self.detachedFrames[func_id]
808 frameno = self.detachedFramesCount[func_id]
809 self.detachedFramesCount[func_id] = frameno + 1
810 return FunctionFrame(self, frameno, func_id)
811
812 def logExpressionResultAndStartFrame(self, nodetype, childset, result):
813 self.startFrame(nodetype, childset)
814 self.logExpressionResult(None, {}, result)
815 return result
816
817 def logExpressionResultAndEndFrames(self, nodetype, frameType, result):
818 self.logExpressionResult(nodetype, {}, result)
819 while frameType != self.stack[-1].type:
820 self.endFrame()
821 self.endFrame()
822 return result
823
824 def startDetachedFrame(self, type, childset, id):
825 frame = CaptureContext(type, childset)
826 self.detachedFrames[id].append(frame)
827 self.stack.append(frame)
828
829 def endFrameType(self, type):
830 while type != self.stack[-1].type:
831 self.endFrame()
832 self.endFrame()
833
834 def startFrame(self, type, childset):
835 frame = CaptureContext(type, childset)
836 self.stack[-1].checkFrameLimit()
837 self.stack[-1].addStatementResult(frame.type, frame.blocks, [])
838 self.stack.append(frame)
839
840 def startChildSet(self, childset):
841 self.stack[-1].startChildSet(childset)
842
843 def endFrame(self):
844 frame = self.stack.pop()
845
846 def endLoop(self):
847 while len(self.stack) != 0:
848 frame = self.stack[-1]
849 if frame.type == 'PYTHON_FOR_LOOP' or frame.type == 'PYTHON_WHILE_LOOP':
850 break
851 self.stack.pop()

Callers 1

executePythonFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected