fix_getcwdu.py 451 B

12345678910111213141516171819
  1. """
  2. Fixer that changes os.getcwdu() to os.getcwd().
  3. """
  4. # Author: Victor Stinner
  5. # Local imports
  6. from .. import fixer_base
  7. from ..fixer_util import Name
  8. class FixGetcwdu(fixer_base.BaseFix):
  9. BM_compatible = True
  10. PATTERN = """
  11. power< 'os' trailer< dot='.' name='getcwdu' > any* >
  12. """
  13. def transform(self, node, results):
  14. name = results["name"]
  15. name.replace(Name("getcwd", prefix=name.prefix))