Skip to content

Instantly share code, notes, and snippets.

@jgarte
Forked from abingham/rope_rename.py
Created June 12, 2022 00:58
Show Gist options
  • Save jgarte/d08b60af9917089d582d6896d0921a9a to your computer and use it in GitHub Desktop.
Save jgarte/d08b60af9917089d582d6896d0921a9a 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