summaryrefslogtreecommitdiffstats
path: root/Lib/lib2to3/fixes/fix_long.py
blob: b5e0bdbe529eeef4259785299c743d639c9bf10c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.

"""Fixer that turns 'long' into 'int' everywhere.
"""

# Local imports
from .. import fixer_base
from ..fixer_util import Name, Number, is_probably_builtin


class FixLong(fixer_base.BaseFix):

    PATTERN = "'long'"

    static_int = Name("int")

    def transform(self, node, results):
        if is_probably_builtin(node):
            new = self.static_int.clone()
            new.prefix = node.prefix
            return new