Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main():
str(3)
with snoop.snoop(depth=3):
result1 = f2(5)
return result1
@snoop.snoop(
depth=2) # Multi-line decorator for extra confusion!
@empty_decorator
@empty_decorator
def main():
str(3)
def main():
my_function = snoop.snoop()(lambda x: x ** 2)
my_function(3)
@snoop.snoop()
def f(x1):
assert not original_tracer_active()
_x2 = (yield x1)
assert not original_tracer_active()
_x3 = 'foo'
assert not original_tracer_active()
_x4 = (yield 2)
assert not original_tracer_active()
@snoop.snoop()
def main():
foo = list(range(1000))
return foo
@snoop.snoop(depth=2)
def f4():
f5()
@snoop.snoop()
def main():
x = (
[
bar(), # 1
bar(), # 2
]
)
with context(
bar(), # 1
bar(), # 2
):
try:
for _ in [
bar(
bar(), # 1
@snoop.snoop()
def f(_one, _two, _three, _four):
_five = None
_six = None
_seven = None
_five, _six, _seven = 5, 6, 7
def trace(self, frame, event, arg):
if not self._is_traced_frame(frame):
if (
self.depth == 1
or self._is_internal_frame(frame)
) and not is_comprehension_frame(frame):
return None
else:
candidate = frame
i = 0
while True:
if is_comprehension_frame(candidate):
candidate = candidate.f_back
continue
i += 1
if self._is_traced_frame(candidate):
break
candidate = candidate.f_back
if i >= self.depth or candidate is None or self._is_internal_frame(candidate):
return None
thread_local = self.config.thread_local
thread_local.__dict__.setdefault('depth', -1)
frame_info = self.frame_infos[frame]
if event in ('call', 'enter'):
thread_local.depth += 1
elif self.config.last_frame and self.config.last_frame is not frame:
line_no = frame_info.last_line_no
def trace(self, frame, event, arg):
if not self._is_traced_frame(frame):
if (
self.depth == 1
or self._is_internal_frame(frame)
) and not is_comprehension_frame(frame):
return None
else:
candidate = frame
i = 0
while True:
if is_comprehension_frame(candidate):
candidate = candidate.f_back
continue
i += 1
if self._is_traced_frame(candidate):
break
candidate = candidate.f_back
if i >= self.depth or candidate is None or self._is_internal_frame(candidate):
return None
thread_local = self.config.thread_local