text stringlengths 0 828 |
|---|
annotation['reye'] = ((annotation['key1'][0] + annotation['key5'][0])/2., (annotation['key1'][1] + annotation['key5'][1])/2.) |
if 'key6' in annotation and 'key10' in annotation: |
annotation['leye'] = ((annotation['key6'][0] + annotation['key10'][0])/2., (annotation['key6'][1] + annotation['key10'][1])/2.) |
elif annotation_type == 'lr-eyes': |
# In this format, the eyes are given in a single row ""le_x le_y re_x re_y"", possibly with a comment line |
# There is only a single annotation per image |
for line in f: |
if len(line) and line[0] != '#': |
positions = line.rstrip().split() |
annotations[0]['leye'] = (float(positions[1]),float(positions[0])) |
annotations[0]['reye'] = (float(positions[3]),float(positions[2])) |
elif annotation_type == 'named': |
# In this format, each line contains three entries: ""keyword x y"" |
for line in f: |
positions = line.rstrip().split() |
if positions: |
annotations[-1][positions[0]] = (float(positions[2]),float(positions[1])) |
elif len(annotations[-1]) > 0: |
# empty line; split between annotations |
annotations.append({}) |
elif annotation_type == 'fddb': |
# This is a special format for the FDDB database |
for line in f: |
positions = line.rstrip().split() |
if not len(positions): |
if len(annotations[-1]) > 0: |
# empty line; split between annotations |
annotations.append({}) |
elif len(positions) == 2: |
annotations[-1][positions[0]] = float(positions[1]) |
elif len(positions) == 3: |
annotations[-1][positions[0]] = (float(positions[2]),float(positions[1])) |
else: |
raise ValueError(""Could not interpret line %s of the annotation file"" % line) |
else: |
raise ValueError(""The given annotation type %s is not known"" % annotation_type) |
if not annotations[-1]: |
del annotations[-1] |
return annotations" |
264,"def _build_opstackd(): |
"""""" |
Builds a dictionary that maps the name of an op-code to the number of elemnts |
it adds to the stack when executed. For some opcodes, the dictionary may |
contain a function which requires the #dis.Instruction object to determine |
the actual value. |
The dictionary mostly only contains information for instructions |
used in expressions. |
"""""" |
def _call_function_argc(argc): |
func_obj = 1 |
args_pos = (argc & 0xff) |
args_kw = ((argc >> 8) & 0xff) * 2 |
return func_obj + args_pos + args_kw |
def _make_function_argc(argc): |
args_pos = (argc + 0xff) |
args_kw = ((argc >> 8) & 0xff) * 2 |
annotations = (argc >> 0x7fff) |
anootations_names = 1 if annotations else 0 |
code_obj = 1 |
qualname = 1 |
return args_pos + args_kw + annotations + anootations_names + code_obj + qualname |
result = { |
'NOP': 0, |
'POP_TOP': -1, |
'ROT_TWO': 0, |
'ROT_THREE': 0, |
'DUP_TOP': 1, |
'DUP_TOP_TWO': 2, |
# Unary operations |
'GET_ITER': 0, |
# Miscellaneous operations |
'PRINT_EXPR': -1, |
'BREAK_LOOP': 0, # xxx: verify |
'CONTINUE_LOOP': 0, # xxx: verify |
'SET_ADD': -1, # xxx: verify |
'LIST_APPEND': -1, # xxx: verify |
'MAP_ADD': -2, # xxx: verify |
'RETURN_VALUE': -1, # xxx: verify |
'YIELD_VALUE': -1, |
'YIELD_FROM': -1, |
'IMPORT_STAR': -1, |
# 'POP_BLOCK': |
# 'POP_EXCEPT': |
# 'END_FINALLY': |
# 'LOAD_BUILD_CLASS': |
# 'SETUP_WITH': |
# 'WITH_CLEANUP_START': |
# 'WITH_CLEANUP_FINISH': |
'STORE_NAME': -1, |
'DELETE_NAME': 0, |
'UNPACK_SEQUENCE': lambda op: op.arg, |
'UNPACK_EX': lambda op: (op.arg & 0xff) - (op.arg >> 8 & 0xff), # xxx: check |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.