rope.refactor.rename
Classes
A class for performing rename refactoring |
|
A class for changing the occurrences of a name in a scope |
Functions
|
Returns the changed source or None if there is no changes |
Module Contents
- class rope.refactor.rename.Rename(project, resource, offset=None)
A class for performing rename refactoring
It can rename everything: classes, functions, modules, packages, methods, variables and keyword arguments.
- project
- resource
- get_old_name()
- get_changes(new_name, in_file=None, in_hierarchy=False, unsure=None, docs=False, resources=None, task_handle=taskhandle.DEFAULT_TASK_HANDLE)
Get the changes needed for this refactoring
Parameters:
in_hierarchy: when renaming a method this keyword forces to rename all matching methods in the hierarchy
docs: when True rename refactoring will rename occurrences in comments and strings where the name is visible. Setting it will make renames faster, too.
unsure: decides what to do about unsure occurrences. If None, they are ignored. Otherwise unsure is called with an instance of occurrence.Occurrence as parameter. If it returns True, the occurrence is considered to be a match.
resources can be a list of rope.base.resources.File to apply this refactoring on. If None, the restructuring will be applied to all python files.
in_file: this argument has been deprecated; use resources instead.
- is_method()
- class rope.refactor.rename.ChangeOccurrences(project, resource, offset)
A class for changing the occurrences of a name in a scope
This class replaces the occurrences of a name. Note that it only changes the scope containing the offset passed to the constructor. What’s more it does not have any side-effects. That is for example changing occurrences of a module does not rename the module; it merely replaces the occurrences of that module in a scope with the given expression. This class is useful for performing many custom refactorings.
- project
- resource
- offset
- old_name
- pymodule
- old_pyname
- get_old_name()
- get_changes(new_name, only_calls=False, reads=True, writes=True)
- rope.refactor.rename.rename_in_module(occurrences_finder, new_name, resource=None, pymodule=None, replace_primary=False, region=None, reads=True, writes=True)
Returns the changed source or None if there is no changes