Skip to content

Instantly share code, notes, and snippets.

@abingham
Created October 11, 2017 06:32
Show Gist options
  • Save abingham/ddb0e52c1a8017c64d72c14d51ef0129 to your computer and use it in GitHub Desktop.
Save abingham/ddb0e52c1a8017c64d72c14d51ef0129 to your computer and use it in GitHub Desktop.
Basic programmatic use of rope
from rope.base import libutils
import rope.base.project
from rope.refactor.rename import Rename
project = rope.base.project.Project('.')
resource = libutils.path_to_resource(project, './sample.py')
renamer = Rename(project, resource, 81) # offset=81
changes = renamer.get_changes('Fnord')
project.do(changes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment