MCPcopy Create free account
hub / github.com/ActiveState/code / find_code

Function find_code

recipes/Python/578965_Python_2_nonlocal/recipe-578965.py:6–14  ·  view source on GitHub ↗
(code, f)

Source from the content-addressed store, hash-verified

4
5# http://www.jonathon-vogel.com/posts/patching_function_bytecode_with_python/
6def find_code(code, f):
7 i = 0
8 while i < len(code):
9 if f(code, i):
10 return i
11 elif code[i] < dis.HAVE_ARGUMENT:
12 i += 1
13 else:
14 i += 3
15
16# http://nedbatchelder.com/blog/201301/byterun_and_making_cells.html
17def make_cell(value):

Callers 1

funcFunction · 0.85

Calls 1

fFunction · 0.50

Tested by

no test coverage detected