MCPcopy
hub / github.com/rocky/python-uncompyle6 / flatten_list

Function flatten_list

uncompyle6/semantics/helper.py:108–128  ·  view source on GitHub ↗

List of expressions may be nested in groups of 32 and 1024 items. flatten that out and return the list

(node)

Source from the content-addressed store, hash-verified

106 return False
107
108def flatten_list(node):
109 """
110 List of expressions may be nested in groups of 32 and 1024
111 items. flatten that out and return the list
112 """
113 flat_elems = []
114 for elem in node:
115 if elem == 'expr1024':
116 for subelem in elem:
117 assert subelem == 'expr32'
118 for subsubelem in subelem:
119 flat_elems.append(subsubelem)
120 elif elem == 'expr32':
121 for subelem in elem:
122 assert subelem == 'expr'
123 flat_elems.append(subelem)
124 else:
125 flat_elems.append(elem)
126 pass
127 pass
128 return flat_elems
129
130# Note: this is only used in Python > 3.0
131# Should move this somewhere more specific?

Callers 6

call36_tupleFunction · 0.90
n_listMethod · 0.90
n_call_kw_pypy37Function · 0.90
n_build_list_unpackFunction · 0.90
n_list_unpackFunction · 0.90
n_build_list_unpackFunction · 0.90

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected