/Lib/lib2to3/fixes/fix_long.py

http://unladen-swallow.googlecode.com/ · Python · 22 lines · 19 code · 1 blank · 2 comment · 0 complexity · 2aaca612bae42bfe84dd0d6139260749 MD5 · raw file

  1. # Copyright 2006 Google, Inc. All Rights Reserved.
  2. # Licensed to PSF under a Contributor Agreement.
  3. """Fixer that turns 'long' into 'int' everywhere.
  4. """
  5. # Local imports
  6. from .. import fixer_base
  7. from ..fixer_util import Name, Number, is_probably_builtin
  8. class FixLong(fixer_base.BaseFix):
  9. PATTERN = "'long'"
  10. static_int = Name("int")
  11. def transform(self, node, results):
  12. if is_probably_builtin(node):
  13. new = self.static_int.clone()
  14. new.set_prefix(node.get_prefix())
  15. return new