__init__.py 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. """rope refactor package
  2. This package contains modules that perform python refactorings.
  3. Refactoring classes perform refactorings in 4 steps:
  4. 1. Collect some data for performing the refactoring and use them
  5. to construct a refactoring class. Like::
  6. renamer = Rename(project, resource, offset)
  7. 2. Some refactorings give you useful information about the
  8. refactoring after their construction. Like::
  9. print(renamer.get_old_name())
  10. 3. Give the refactoring class more information about how to
  11. perform the refactoring and get the changes this refactoring is
  12. going to make. This is done by calling `get_changes` method of the
  13. refactoring class. Like::
  14. changes = renamer.get_changes(new_name)
  15. 4. You can commit the changes. Like::
  16. project.do(changes)
  17. These steps are like the steps IDEs usually do for performing a
  18. refactoring. These are the things an IDE does in each step:
  19. 1. Construct a refactoring object by giving it information like
  20. resource, offset and ... . Some of the refactoring problems (like
  21. performing rename refactoring on language keywords) can be reported
  22. here.
  23. 2. Print some information about the refactoring and ask the user
  24. about the information that are necessary for completing the
  25. refactoring (like new name).
  26. 3. Call the `get_changes` by passing it information asked from
  27. the user (if necessary) and get and preview the changes returned by
  28. it.
  29. 4. perform the refactoring.
  30. From ``0.5m5`` release the `get_changes()` method of some time-
  31. consuming refactorings take an optional `rope.base.taskhandle.
  32. TaskHandle` parameter. You can use this object for stopping or
  33. monitoring the progress of refactorings.
  34. """
  35. from rope.refactor.importutils import ImportOrganizer
  36. from rope.refactor.topackage import ModuleToPackage
  37. __all__ = ['rename', 'move', 'inline', 'extract', 'restructure', 'topackage',
  38. 'importutils', 'usefunction', 'change_signature',
  39. 'encapsulate_field', 'introduce_factory', 'introduce_parameter',
  40. 'localtofield', 'method_object', 'multiproject']