rope.base.change

Classes

Change

The base class for changes

ChangeSet

A collection of Change objects

ChangeContents

A class to change the contents of a file

MoveResource

Move a resource to a new location

CreateResource

A class to create a resource

CreateFolder

A class to create a folder

CreateFile

A class to create a file

RemoveResource

A class to remove a resource

ChangeToData

DataToChange

Functions

count_changes(change)

Counts the number of basic changes a Change will make

create_job_set(task_handle, change)

Module Contents

class rope.base.change.Change

The base class for changes

Rope refactorings return Change objects. They can be previewed, committed or undone.

do(job_set=None)

Perform the change

Note

Do use this directly. Use Project.do() instead.

undo(job_set=None)

Perform the change

Note

Do use this directly. Use History.undo() instead.

get_description()

Return the description of this change

This can be used for previewing the changes.

get_changed_resources()

Return the list of resources that will be changed

class rope.base.change.ChangeSet(description, timestamp=None)

Bases: 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

changes = []
description
time = None
do(job_set=taskhandle.DEFAULT_JOB_SET)

Perform the change

Note

Do use this directly. Use Project.do() instead.

undo(job_set=taskhandle.DEFAULT_JOB_SET)

Perform the change

Note

Do use this directly. Use History.undo() instead.

add_change(change)
get_description()

Return the description of this change

This can be used for previewing the changes.

get_changed_resources()

Return the list of resources that will be changed

class rope.base.change.ChangeContents(resource, new_contents, old_contents=None)

Bases: 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

resource
new_contents
old_contents = None
do()

Perform the change

Note

Do use this directly. Use Project.do() instead.

undo()

Perform the change

Note

Do use this directly. Use History.undo() instead.

get_description()

Return the description of this change

This can be used for previewing the changes.

get_changed_resources()

Return the list of resources that will be changed

class rope.base.change.MoveResource(resource, new_location, exact=False)

Bases: 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.

project
resource
do()

Perform the change

Note

Do use this directly. Use Project.do() instead.

undo()

Perform the change

Note

Do use this directly. Use History.undo() instead.

get_description()

Return the description of this change

This can be used for previewing the changes.

get_changed_resources()

Return the list of resources that will be changed

class rope.base.change.CreateResource(resource)

Bases: Change

A class to create a resource

Fields:

  • resource: The resource to create

resource
do()

Perform the change

Note

Do use this directly. Use Project.do() instead.

undo()

Perform the change

Note

Do use this directly. Use History.undo() instead.

get_description()

Return the description of this change

This can be used for previewing the changes.

get_changed_resources()

Return the list of resources that will be changed

class rope.base.change.CreateFolder(parent, name)

Bases: CreateResource

A class to create a folder

See docs for CreateResource.

resource
do()

Perform the change

Note

Do use this directly. Use Project.do() instead.

undo()

Perform the change

Note

Do use this directly. Use History.undo() instead.

get_description()

Return the description of this change

This can be used for previewing the changes.

get_changed_resources()

Return the list of resources that will be changed

class rope.base.change.CreateFile(parent, name)

Bases: CreateResource

A class to create a file

See docs for CreateResource.

resource
do()

Perform the change

Note

Do use this directly. Use Project.do() instead.

undo()

Perform the change

Note

Do use this directly. Use History.undo() instead.

get_description()

Return the description of this change

This can be used for previewing the changes.

get_changed_resources()

Return the list of resources that will be changed

class rope.base.change.RemoveResource(resource)

Bases: Change

A class to remove a resource

Fields:

  • resource: The resource to be removed

resource
do()

Perform the change

Note

Do use this directly. Use Project.do() instead.

abstractmethod undo()

Perform the change

Note

Do use this directly. Use History.undo() instead.

get_changed_resources()

Return the list of resources that will be changed

get_description()

Return the description of this change

This can be used for previewing the changes.

rope.base.change.count_changes(change)

Counts the number of basic changes a Change will make

rope.base.change.create_job_set(task_handle, change)
class rope.base.change.ChangeToData
convertChangeSet(change)
convertChangeContents(change)
convertMoveResource(change)
convertCreateResource(change)
convertRemoveResource(change)
class rope.base.change.DataToChange(project)
project
makeChangeSet(description, changes, time=None)
makeChangeContents(path, new_contents, old_contents)
makeMoveResource(old_path, new_path)
makeCreateResource(path, is_folder)
makeRemoveResource(path, is_folder)