In [2]:
import data
import gensim as g
import inspect
import dis
import itertools


Using gpu device 0: GeForce GTX 970 (CNMeM is disabled, cuDNN not available)

In [3]:
# gather Python entities from libraries
l_interested = data.get_entity_list(data.libinfo.interested_libs)
l_code = list(map(data.get_code, l_interested))


C:\Anaconda3\envs\cnn\lib\site-packages\sklearn\lda.py:4: DeprecationWarning: lda.LDA has been moved to discriminant_analysis.LinearDiscriminantAnalysis in 0.17 and will be removed in 0.19
  "in 0.17 and will be removed in 0.19", DeprecationWarning)
C:\Anaconda3\envs\cnn\lib\site-packages\sklearn\metrics\metrics.py:4: DeprecationWarning: sklearn.metrics.metrics is deprecated and will be removed in 0.18. Please import from sklearn.metrics
  DeprecationWarning)
C:\Anaconda3\envs\cnn\lib\site-packages\sklearn\qda.py:4: DeprecationWarning: qda.QDA has been moved to discriminant_analysis.QuadraticDiscriminantAnalysis in 0.17 and will be removed in 0.19.
  "in 0.17 and will be removed in 0.19.", DeprecationWarning)

In [27]:
print(*(i for i in dis.get_instructions(l_code[1234])), sep='\n')


Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=0, starts_line=802, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=0, argval='shape', argrepr='shape', offset=3, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=1, argrepr='1', offset=6, starts_line=None, is_jump_target=False)
Instruction(opname='BINARY_SUBSCR', opcode=25, arg=None, argval=None, argrepr='', offset=9, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='len', argrepr='len', offset=10, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='self', argrepr='self', offset=13, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=2, argval='classes_', argrepr='classes_', offset=16, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=19, starts_line=None, is_jump_target=False)
Instruction(opname='COMPARE_OP', opcode=107, arg=3, argval='!=', argrepr='!=', offset=22, starts_line=None, is_jump_target=False)
Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=68, argval=68, argrepr='', offset=25, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='ValueError', argrepr='ValueError', offset=28, starts_line=803, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=2, argval='Expected indicator for {0} classes, but got {1}', argrepr="'Expected indicator for {0} classes, but got {1}'", offset=31, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=4, argval='format', argrepr='format', offset=34, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='len', argrepr='len', offset=37, starts_line=804, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=0, argval='self', argrepr='self', offset=40, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=2, argval='classes_', argrepr='classes_', offset=43, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=46, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=49, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=0, argval='shape', argrepr='shape', offset=52, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=1, argrepr='1', offset=55, starts_line=None, is_jump_target=False)
Instruction(opname='BINARY_SUBSCR', opcode=25, arg=None, argval=None, argrepr='', offset=58, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=2, argval=2, argrepr='2 positional, 0 keyword pair', offset=59, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=62, starts_line=None, is_jump_target=False)
Instruction(opname='RAISE_VARARGS', opcode=130, arg=1, argval=1, argrepr='', offset=65, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=5, argval='sp', argrepr='sp', offset=68, starts_line=806, is_jump_target=True)
Instruction(opname='LOAD_ATTR', opcode=106, arg=6, argval='issparse', argrepr='issparse', offset=71, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=74, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=77, starts_line=None, is_jump_target=False)
Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=228, argval=228, argrepr='', offset=80, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=83, starts_line=807, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=7, argval='tocsr', argrepr='tocsr', offset=86, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=0, argval=0, argrepr='0 positional, 0 keyword pair', offset=89, starts_line=None, is_jump_target=False)
Instruction(opname='STORE_DEREF', opcode=137, arg=1, argval='yt', argrepr='yt', offset=92, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='len', argrepr='len', offset=95, starts_line=808, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=98, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=8, argval='data', argrepr='data', offset=101, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=104, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=0, argrepr='0', offset=107, starts_line=None, is_jump_target=False)
Instruction(opname='COMPARE_OP', opcode=107, arg=3, argval='!=', argrepr='!=', offset=110, starts_line=None, is_jump_target=False)
Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=167, argval=167, argrepr='', offset=113, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='len', argrepr='len', offset=116, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=9, argval='np', argrepr='np', offset=119, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=10, argval='setdiff1d', argrepr='setdiff1d', offset=122, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=125, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=8, argval='data', argrepr='data', offset=128, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=0, argrepr='0', offset=131, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=1, argrepr='1', offset=134, starts_line=None, is_jump_target=False)
Instruction(opname='BUILD_LIST', opcode=103, arg=2, argval=2, argrepr='', offset=137, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=2, argval=2, argrepr='2 positional, 0 keyword pair', offset=140, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=143, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=0, argrepr='0', offset=146, starts_line=None, is_jump_target=False)
Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=149, starts_line=None, is_jump_target=False)
Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=167, argval=167, argrepr='', offset=152, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='ValueError', argrepr='ValueError', offset=155, starts_line=809, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=4, argval='Expected only 0s and 1s in label indicator.', argrepr="'Expected only 0s and 1s in label indicator.'", offset=158, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=161, starts_line=None, is_jump_target=False)
Instruction(opname='RAISE_VARARGS', opcode=130, arg=1, argval=1, argrepr='', offset=164, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='self', argrepr='self', offset=167, starts_line=810, is_jump_target=True)
Instruction(opname='LOAD_CLOSURE', opcode=135, arg=1, argval='yt', argrepr='yt', offset=170, starts_line=None, is_jump_target=False)
Instruction(opname='BUILD_TUPLE', opcode=102, arg=2, argval=2, argrepr='', offset=173, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=5, argval=<code object <listcomp> at 0x0000024AB413EB70, file "C:\Anaconda3\lib\site-packages\sklearn\preprocessing\label.py", line 810>, argrepr='<code object <listcomp> at 0x0000024AB413EB70, file "C:\\Anaconda3\\lib\\site-packages\\sklearn\\preprocessing\\label.py", line 810>', offset=176, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='MultiLabelBinarizer.inverse_transform.<locals>.<listcomp>', argrepr="'MultiLabelBinarizer.inverse_transform.<locals>.<listcomp>'", offset=179, starts_line=None, is_jump_target=False)
Instruction(opname='MAKE_CLOSURE', opcode=134, arg=0, argval=0, argrepr='', offset=182, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=11, argval='zip', argrepr='zip', offset=185, starts_line=811, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=188, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=12, argval='indptr', argrepr='indptr', offset=191, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=None, argrepr='None', offset=194, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=10, argval=-1, argrepr='-1', offset=197, starts_line=None, is_jump_target=False)
Instruction(opname='BUILD_SLICE', opcode=133, arg=2, argval=2, argrepr='', offset=200, starts_line=None, is_jump_target=False)
Instruction(opname='BINARY_SUBSCR', opcode=25, arg=None, argval=None, argrepr='', offset=203, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=204, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=12, argval='indptr', argrepr='indptr', offset=207, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=1, argrepr='1', offset=210, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=None, argrepr='None', offset=213, starts_line=None, is_jump_target=False)
Instruction(opname='BUILD_SLICE', opcode=133, arg=2, argval=2, argrepr='', offset=216, starts_line=None, is_jump_target=False)
Instruction(opname='BINARY_SUBSCR', opcode=25, arg=None, argval=None, argrepr='', offset=219, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=2, argval=2, argrepr='2 positional, 0 keyword pair', offset=220, starts_line=None, is_jump_target=False)
Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=223, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=224, starts_line=None, is_jump_target=False)
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=227, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=9, argval='np', argrepr='np', offset=228, starts_line=813, is_jump_target=True)
Instruction(opname='LOAD_ATTR', opcode=106, arg=10, argval='setdiff1d', argrepr='setdiff1d', offset=231, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=234, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=0, argrepr='0', offset=237, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=1, argval=1, argrepr='1', offset=240, starts_line=None, is_jump_target=False)
Instruction(opname='BUILD_LIST', opcode=103, arg=2, argval=2, argrepr='', offset=243, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=2, argval=2, argrepr='2 positional, 0 keyword pair', offset=246, starts_line=None, is_jump_target=False)
Instruction(opname='STORE_FAST', opcode=125, arg=2, argval='unexpected', argrepr='unexpected', offset=249, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=1, argval='len', argrepr='len', offset=252, starts_line=814, is_jump_target=False)
Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='unexpected', argrepr='unexpected', offset=255, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=258, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=3, argval=0, argrepr='0', offset=261, starts_line=None, is_jump_target=False)
Instruction(opname='COMPARE_OP', opcode=107, arg=4, argval='>', argrepr='>', offset=264, starts_line=None, is_jump_target=False)
Instruction(opname='POP_JUMP_IF_FALSE', opcode=114, arg=291, argval=291, argrepr='', offset=267, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_GLOBAL', opcode=116, arg=3, argval='ValueError', argrepr='ValueError', offset=270, starts_line=815, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=8, argval='Expected only 0s and 1s in label indicator. Also got {0}', argrepr="'Expected only 0s and 1s in label indicator. Also got {0}'", offset=273, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_ATTR', opcode=106, arg=4, argval='format', argrepr='format', offset=276, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_FAST', opcode=124, arg=2, argval='unexpected', argrepr='unexpected', offset=279, starts_line=816, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=282, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=285, starts_line=None, is_jump_target=False)
Instruction(opname='RAISE_VARARGS', opcode=130, arg=1, argval=1, argrepr='', offset=288, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CLOSURE', opcode=135, arg=0, argval='self', argrepr='self', offset=291, starts_line=817, is_jump_target=True)
Instruction(opname='BUILD_TUPLE', opcode=102, arg=1, argval=1, argrepr='', offset=294, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=9, argval=<code object <listcomp> at 0x0000024AB413EC00, file "C:\Anaconda3\lib\site-packages\sklearn\preprocessing\label.py", line 817>, argrepr='<code object <listcomp> at 0x0000024AB413EC00, file "C:\\Anaconda3\\lib\\site-packages\\sklearn\\preprocessing\\label.py", line 817>', offset=297, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=6, argval='MultiLabelBinarizer.inverse_transform.<locals>.<listcomp>', argrepr="'MultiLabelBinarizer.inverse_transform.<locals>.<listcomp>'", offset=300, starts_line=None, is_jump_target=False)
Instruction(opname='MAKE_CLOSURE', opcode=134, arg=0, argval=0, argrepr='', offset=303, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_DEREF', opcode=136, arg=1, argval='yt', argrepr='yt', offset=306, starts_line=818, is_jump_target=False)
Instruction(opname='GET_ITER', opcode=68, arg=None, argval=None, argrepr='', offset=309, starts_line=None, is_jump_target=False)
Instruction(opname='CALL_FUNCTION', opcode=131, arg=1, argval=1, argrepr='1 positional, 0 keyword pair', offset=310, starts_line=None, is_jump_target=False)
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=313, starts_line=None, is_jump_target=False)
Instruction(opname='LOAD_CONST', opcode=100, arg=7, argval=None, argrepr='None', offset=314, starts_line=None, is_jump_target=False)
Instruction(opname='RETURN_VALUE', opcode=83, arg=None, argval=None, argrepr='', offset=317, starts_line=None, is_jump_target=False)

In [12]:
l_ins = [[i.opname for i in dis.get_instructions(code)]
        for code in l_code]
all_ins = list(itertools.chain(*l_ins))
print(len(all_ins))
all_ins_unique = set(all_ins)
print(len(all_ins_unique))


408243
84

In [13]:
model = g.models.word2vec.Word2Vec(l_ins, size=8, window=10, min_count=1, workers=4, seed=1337, iter=20)

In [21]:
print(*[x for i, x in model.most_similar(positive=['BINARY_ADD'])], sep='\n')


0.9796327352523804
0.9578515887260437
0.9076402187347412
0.9009826183319092
0.8350107669830322
0.7789117693901062
0.6852640509605408
0.643293023109436
0.6002776026725769
0.599688708782196

In [30]:
print(*["(%s)"%', '.join("%.2f"%x for x in model[i]) for i, _ in model.most_similar(positive=['BINARY_ADD'])], sep='\n')


(0.23, 2.31, 3.36, 1.12, -2.90, 2.85, -0.58, 7.54)
(0.44, 2.09, 2.36, 0.39, -2.34, 2.97, -1.14, 8.94)
(-1.16, 2.90, 2.60, -0.90, -1.08, 3.64, -2.92, 8.05)
(0.05, 3.70, 2.34, -0.68, -1.19, 2.61, -1.53, 7.86)
(1.45, -0.95, 0.55, 0.21, -1.79, 1.49, 0.25, 6.41)
(0.93, 0.20, 0.50, 0.52, -1.17, 0.69, 1.01, 1.89)
(2.01, 0.48, -0.46, -0.20, -2.15, 1.86, -1.01, 1.92)
(1.52, 0.85, 4.73, 0.14, -0.04, -1.18, 1.14, 5.49)
(-0.29, -0.20, -1.39, 2.25, -1.15, 1.36, -0.47, 1.63)
(0.12, 1.09, 4.18, 1.13, 1.23, -1.69, 0.56, 5.49)

In [31]:
"(%s)"%', '.join("%.2f"%x for x in model['BINARY_ADD'])


Out[31]:
'(-0.58, 1.44, 2.59, 1.45, -3.26, 3.50, -1.04, 6.47)'

In [54]:
all_ins_unique


Out[54]:
{'BINARY_ADD',
 'BINARY_AND',
 'BINARY_FLOOR_DIVIDE',
 'BINARY_LSHIFT',
 'BINARY_MODULO',
 'BINARY_MULTIPLY',
 'BINARY_OR',
 'BINARY_POWER',
 'BINARY_RSHIFT',
 'BINARY_SUBSCR',
 'BINARY_SUBTRACT',
 'BINARY_TRUE_DIVIDE',
 'BINARY_XOR',
 'BREAK_LOOP',
 'BUILD_LIST',
 'BUILD_MAP',
 'BUILD_SLICE',
 'BUILD_TUPLE',
 'CALL_FUNCTION',
 'CALL_FUNCTION_KW',
 'CALL_FUNCTION_VAR',
 'CALL_FUNCTION_VAR_KW',
 'COMPARE_OP',
 'CONTINUE_LOOP',
 'DELETE_ATTR',
 'DELETE_FAST',
 'DELETE_SUBSCR',
 'DUP_TOP',
 'DUP_TOP_TWO',
 'END_FINALLY',
 'FOR_ITER',
 'GET_ITER',
 'IMPORT_FROM',
 'IMPORT_NAME',
 'INPLACE_ADD',
 'INPLACE_AND',
 'INPLACE_FLOOR_DIVIDE',
 'INPLACE_LSHIFT',
 'INPLACE_MODULO',
 'INPLACE_MULTIPLY',
 'INPLACE_OR',
 'INPLACE_POWER',
 'INPLACE_RSHIFT',
 'INPLACE_SUBTRACT',
 'INPLACE_TRUE_DIVIDE',
 'JUMP_ABSOLUTE',
 'JUMP_FORWARD',
 'JUMP_IF_FALSE_OR_POP',
 'JUMP_IF_TRUE_OR_POP',
 'LOAD_ATTR',
 'LOAD_BUILD_CLASS',
 'LOAD_CLOSURE',
 'LOAD_CONST',
 'LOAD_DEREF',
 'LOAD_FAST',
 'LOAD_GLOBAL',
 'MAKE_CLOSURE',
 'MAKE_FUNCTION',
 'POP_BLOCK',
 'POP_EXCEPT',
 'POP_JUMP_IF_FALSE',
 'POP_JUMP_IF_TRUE',
 'POP_TOP',
 'RAISE_VARARGS',
 'RETURN_VALUE',
 'ROT_THREE',
 'ROT_TWO',
 'SETUP_EXCEPT',
 'SETUP_FINALLY',
 'SETUP_LOOP',
 'SETUP_WITH',
 'STORE_ATTR',
 'STORE_DEREF',
 'STORE_FAST',
 'STORE_GLOBAL',
 'STORE_SUBSCR',
 'UNARY_INVERT',
 'UNARY_NEGATIVE',
 'UNARY_NOT',
 'UNARY_POSITIVE',
 'UNPACK_SEQUENCE',
 'WITH_CLEANUP_FINISH',
 'WITH_CLEANUP_START',
 'YIELD_VALUE'}

In [11]:
import numpy as np
np.mean([len(x) for x in l_ins])


Out[11]:
83.111359934853425

In [ ]: