Commits

Ali Gholami Rudi  committed 9165ac6

move: cleaning up

  • Participants
  • Parent commits aacd238

Comments (0)

Files changed (1)

File rope/refactor/move.py

         # Organizing imports
         source = result
         pymodule = self.pycore.get_string_module(source, dest)
-        source = self.import_tools.organize_imports(pymodule,
-                                                    sort=False, unused=False)
+        source = self.import_tools.organize_imports(pymodule, sort=False,
+                                                    unused=False)
         return ChangeContents(dest, source)
 
     def _get_moving_element_with_imports(self):
         if source is None:
             return pymodule, False
         else:
-            return self.pycore.get_string_module(source, pymodule.get_resource()), True
+            resource = pymodule.get_resource()
+            pymodule = self.pycore.get_string_module(source, resource)
+            return pymodule, True
 
 
 class MoveModule(object):
     pymodule = pycore.get_string_module(source, resource)
 
     # extracting imports after changes
-    module_with_imports = import_tools.module_imports(pymodule)
+    module_imports = import_tools.module_imports(pymodule)
     imports = [import_stmt.import_info
-               for import_stmt in module_with_imports.imports]
+               for import_stmt in module_imports.imports]
     start = 1
-    if module_with_imports.imports:
-        start = module_with_imports.imports[-1].end_line
+    if module_imports.imports:
+        start = module_imports.imports[-1].end_line
     lines = codeanalyze.SourceLinesAdapter(source)
     while start < lines.length() and not lines.get_line(start).strip():
         start += 1