• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1from lib2to3.fixer_base import BaseFix
2from lib2to3.fixer_util import Name
3
4class FixParrot(BaseFix):
5    """
6    Change functions named 'parrot' to 'cheese'.
7    """
8
9    PATTERN = """funcdef < 'def' name='parrot' any* >"""
10
11    def transform(self, node, results):
12        name = results["name"]
13        name.replace(Name("cheese", name.prefix))
14