Return a NodeInfo nametuple for a fragment-deparsed `deparsed` at `tup`. `tup` is a name and offset tuple, `deparsed` is a fragment object and `code` is instruction bytecode.
(tup, deparsed, code)
| 2252 | |
| 2253 | |
| 2254 | def deparsed_find(tup, deparsed, code): |
| 2255 | """Return a NodeInfo nametuple for a fragment-deparsed `deparsed` at `tup`. |
| 2256 | |
| 2257 | `tup` is a name and offset tuple, `deparsed` is a fragment object |
| 2258 | and `code` is instruction bytecode.""" |
| 2259 | nodeInfo = None |
| 2260 | name, last_i = tup |
| 2261 | if not hasattr(deparsed, "offsets"): |
| 2262 | return None |
| 2263 | if (name, last_i) in deparsed.offsets.keys(): |
| 2264 | nodeInfo = deparsed.offsets[name, last_i] |
| 2265 | else: |
| 2266 | from uncompyle6.scanner import get_scanner |
| 2267 | |
| 2268 | scanner = get_scanner(deparsed.version) |
| 2269 | co = code.co_code |
| 2270 | if op_at_code_loc(co, last_i, scanner.opc) == "DUP_TOP": |
| 2271 | offset = deparsed.scanner.next_offset(co[last_i], last_i) |
| 2272 | if (name, offset) in deparsed.offsets: |
| 2273 | nodeInfo = deparsed.offsets[name, offset] |
| 2274 | |
| 2275 | return nodeInfo |
| 2276 | |
| 2277 | |
| 2278 | # if __name__ == "__main__": |
nothing calls this directly
no test coverage detected