PageRenderTime 84ms CodeModel.GetById 40ms app.highlight 7ms RepoModel.GetById 34ms app.codeStats 0ms

/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
 4"""Fixer that turns 'long' into 'int' everywhere.
 5"""
 6
 7# Local imports
 8from .. import fixer_base
 9from ..fixer_util import Name, Number, is_probably_builtin
10
11
12class FixLong(fixer_base.BaseFix):
13
14    PATTERN = "'long'"
15
16    static_int = Name("int")
17
18    def transform(self, node, results):
19        if is_probably_builtin(node):
20            new = self.static_int.clone()
21            new.set_prefix(node.get_prefix())
22            return new