From 2b174ecf2c27172a5fabe775b0089a589813d9a8 Mon Sep 17 00:00:00 2001 From: David Halter Date: Thu, 21 Feb 2013 20:42:06 +0430 Subject: [PATCH] simplify and fix refactoring: extract --- jedi/refactoring.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jedi/refactoring.py b/jedi/refactoring.py index 01bc362a..f478d4e0 100644 --- a/jedi/refactoring.py +++ b/jedi/refactoring.py @@ -3,7 +3,7 @@ Introduce some basic refactoring functions to |jedi|. This module is still in a very early development stage and needs much testing and improvement. .. warning:: I won't do too much here, but if anyone wants to step in, please - do. + do. Refactoring is none of my priorities It uses the |jedi| `API `_ and supports currently the following functions (sometimes bug-prone): @@ -115,10 +115,8 @@ def extract(script, new_name): line_index = pos[0] - 1 arr, index = helpers.array_for_pos(user_stmt, pos) if arr is not None: - s = arr.start_pos[0], arr.start_pos[1] + 1 - positions = [s] + [a.start_pos for a in arr] + [arr.end_pos] - start_pos = positions[index] - end_pos = positions[index + 1][0], positions[index + 1][1] - 1 + start_pos = arr[index].start_pos + end_pos = arr[index].end_pos # take full line if the start line is different from end line e = end_pos[1] if end_pos[0] == start_pos[0] else None