rope.base.change ================ .. py:module:: rope.base.change Classes ------- .. autoapisummary:: rope.base.change.Change rope.base.change.ChangeSet rope.base.change.ChangeContents rope.base.change.MoveResource rope.base.change.CreateResource rope.base.change.CreateFolder rope.base.change.CreateFile rope.base.change.RemoveResource rope.base.change.ChangeToData rope.base.change.DataToChange Functions --------- .. autoapisummary:: rope.base.change.count_changes rope.base.change.create_job_set Module Contents --------------- .. py:class:: Change The base class for changes Rope refactorings return `Change` objects. They can be previewed, committed or undone. .. py:method:: do(job_set=None) Perform the change .. note:: Do use this directly. Use `Project.do()` instead. .. py:method:: undo(job_set=None) Perform the change .. note:: Do use this directly. Use `History.undo()` instead. .. py:method:: get_description() Return the description of this change This can be used for previewing the changes. .. py:method:: get_changed_resources() Return the list of resources that will be changed .. py:class:: ChangeSet(description, timestamp=None) Bases: :py:obj:`Change` A collection of `Change` objects This class holds a collection of changes. This class provides these fields: * `changes`: the list of changes * `description`: the goal of these changes .. py:attribute:: changes :value: [] .. py:attribute:: description .. py:attribute:: time :value: None .. py:method:: do(job_set=taskhandle.DEFAULT_JOB_SET) Perform the change .. note:: Do use this directly. Use `Project.do()` instead. .. py:method:: undo(job_set=taskhandle.DEFAULT_JOB_SET) Perform the change .. note:: Do use this directly. Use `History.undo()` instead. .. py:method:: add_change(change) .. py:method:: get_description() Return the description of this change This can be used for previewing the changes. .. py:method:: get_changed_resources() Return the list of resources that will be changed .. py:class:: ChangeContents(resource, new_contents, old_contents=None) Bases: :py:obj:`Change` A class to change the contents of a file Fields: * `resource`: The `rope.base.resources.File` to change * `new_contents`: What to write in the file .. py:attribute:: resource .. py:attribute:: new_contents .. py:attribute:: old_contents :value: None .. py:method:: do() Perform the change .. note:: Do use this directly. Use `Project.do()` instead. .. py:method:: undo() Perform the change .. note:: Do use this directly. Use `History.undo()` instead. .. py:method:: get_description() Return the description of this change This can be used for previewing the changes. .. py:method:: get_changed_resources() Return the list of resources that will be changed .. py:class:: MoveResource(resource, new_location, exact=False) Bases: :py:obj:`Change` Move a resource to a new location Fields: * `resource`: The `rope.base.resources.Resource` to move * `new_resource`: The destination for move; It is the moved resource not the folder containing that resource. .. py:attribute:: project .. py:attribute:: resource .. py:method:: do() Perform the change .. note:: Do use this directly. Use `Project.do()` instead. .. py:method:: undo() Perform the change .. note:: Do use this directly. Use `History.undo()` instead. .. py:method:: get_description() Return the description of this change This can be used for previewing the changes. .. py:method:: get_changed_resources() Return the list of resources that will be changed .. py:class:: CreateResource(resource) Bases: :py:obj:`Change` A class to create a resource Fields: * `resource`: The resource to create .. py:attribute:: resource .. py:method:: do() Perform the change .. note:: Do use this directly. Use `Project.do()` instead. .. py:method:: undo() Perform the change .. note:: Do use this directly. Use `History.undo()` instead. .. py:method:: get_description() Return the description of this change This can be used for previewing the changes. .. py:method:: get_changed_resources() Return the list of resources that will be changed .. py:class:: CreateFolder(parent, name) Bases: :py:obj:`CreateResource` A class to create a folder See docs for `CreateResource`. .. py:attribute:: resource .. py:method:: do() Perform the change .. note:: Do use this directly. Use `Project.do()` instead. .. py:method:: undo() Perform the change .. note:: Do use this directly. Use `History.undo()` instead. .. py:method:: get_description() Return the description of this change This can be used for previewing the changes. .. py:method:: get_changed_resources() Return the list of resources that will be changed .. py:class:: CreateFile(parent, name) Bases: :py:obj:`CreateResource` A class to create a file See docs for `CreateResource`. .. py:attribute:: resource .. py:method:: do() Perform the change .. note:: Do use this directly. Use `Project.do()` instead. .. py:method:: undo() Perform the change .. note:: Do use this directly. Use `History.undo()` instead. .. py:method:: get_description() Return the description of this change This can be used for previewing the changes. .. py:method:: get_changed_resources() Return the list of resources that will be changed .. py:class:: RemoveResource(resource) Bases: :py:obj:`Change` A class to remove a resource Fields: * `resource`: The resource to be removed .. py:attribute:: resource .. py:method:: do() Perform the change .. note:: Do use this directly. Use `Project.do()` instead. .. py:method:: undo() :abstractmethod: Perform the change .. note:: Do use this directly. Use `History.undo()` instead. .. py:method:: get_changed_resources() Return the list of resources that will be changed .. py:method:: get_description() Return the description of this change This can be used for previewing the changes. .. py:function:: count_changes(change) Counts the number of basic changes a `Change` will make .. py:function:: create_job_set(task_handle, change) .. py:class:: ChangeToData .. py:method:: convertChangeSet(change) .. py:method:: convertChangeContents(change) .. py:method:: convertMoveResource(change) .. py:method:: convertCreateResource(change) .. py:method:: convertRemoveResource(change) .. py:class:: DataToChange(project) .. py:attribute:: project .. py:method:: makeChangeSet(description, changes, time=None) .. py:method:: makeChangeContents(path, new_contents, old_contents) .. py:method:: makeMoveResource(old_path, new_path) .. py:method:: makeCreateResource(path, is_folder) .. py:method:: makeRemoveResource(path, is_folder)