@staticmethod<EOL><INDENT>def find_globals(code):<DEDENT>
cur_byte = <NUM_LIT:0><EOL>byte_code = code.co_code<EOL>names = set()<EOL>while cur_byte < len(byte_code):<EOL><INDENT>op = ord(byte_code[cur_byte])<EOL>if op >= dis.HAVE_ARGUMENT:<EOL><INDENT>if op == _LOAD_GLOBAL:<EOL><INDENT>oparg = ord(byte_code[cur_byte + <NUM_LIT:1>]) + (ord(byte_code[cur_byte + <NUM_LIT:2>]) << <NUM_LIT:8>)<EOL>name = code.co_names[oparg]<EOL>names.add(name)<EOL><DEDENT>cur_byte += <NUM_LIT:2><EOL><DEDENT>cur_byte += <NUM_LIT:1><EOL><DEDENT>return names<EOL>
walks the byte code to find the variables which are actually globals