The acorn AST is tricky. This returns all the children of an element :param ast tree: :rtype: list[ast]
(tree)
| 201 | |
| 202 | |
| 203 | def children(tree): |
| 204 | """ |
| 205 | The acorn AST is tricky. This returns all the children of an element |
| 206 | :param ast tree: |
| 207 | :rtype: list[ast] |
| 208 | """ |
| 209 | assert type(tree) == dict |
| 210 | ret = [] |
| 211 | for k, v in tree.items(): |
| 212 | if type(v) == dict and v.get('type'): |
| 213 | ret.append(v) |
| 214 | if type(v) == list: |
| 215 | ret += filter(None, v) |
| 216 | return ret |
| 217 | |
| 218 | |
| 219 | def get_inherits(tree): |