rope.refactor.rename ==================== .. py:module:: rope.refactor.rename Classes ------- .. autoapisummary:: rope.refactor.rename.Rename rope.refactor.rename.ChangeOccurrences Functions --------- .. autoapisummary:: rope.refactor.rename.rename_in_module Module Contents --------------- .. py:class:: Rename(project, resource, offset=None) A class for performing rename refactoring It can rename everything: classes, functions, modules, packages, methods, variables and keyword arguments. .. py:attribute:: project .. py:attribute:: resource .. py:method:: get_old_name() .. py:method:: 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. .. py:method:: validate_changes(new_name: str, **_unused) .. py:method:: is_method() .. py:class:: 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. .. py:attribute:: project .. py:attribute:: resource .. py:attribute:: offset .. py:attribute:: old_name .. py:attribute:: pymodule .. py:attribute:: old_pyname .. py:method:: get_old_name() .. py:method:: get_changes(new_name, only_calls=False, reads=True, writes=True) .. py:function:: 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