Like resolve, but extracts the context informartion from an entity.
(node, source, entity)
| 259 | |
| 260 | |
| 261 | def resolve_entity(node, source, entity): |
| 262 | """Like resolve, but extracts the context informartion from an entity.""" |
| 263 | lines, lineno = tf_inspect.getsourcelines(entity) |
| 264 | filepath = tf_inspect.getsourcefile(entity) |
| 265 | |
| 266 | # Poor man's attempt at guessing the column offset: count the leading |
| 267 | # whitespace. This might not work well with tabs. |
| 268 | definition_line = lines[0] |
| 269 | col_offset = len(definition_line) - len(definition_line.lstrip()) |
| 270 | |
| 271 | resolve(node, source, filepath, lineno, col_offset) |