# Path: py3kwarn2to3/fixer_base.py
# class BaseFix(object):
# class ConditionalFix(BaseFix):
#     PATTERN = None  # Most subclasses should override with a string literal
#             PC = PatternCompiler()
#     def __init__(self, options, log):
#     def compile_pattern(self):
#     def set_filename(self, filename):
#     def match(self, node):
#     def transform(self, node, results):
#     def new_name(self, template=u"xxx_todo_changeme"):
#     def log_message(self, message):
#     def cannot_convert(self, node, reason=None):
#     def warning(self, node, reason):
#     def start_tree(self, tree, filename):
#     def finish_tree(self, tree, filename):
#     def start_tree(self, *args):
#     def should_skip(self, node):
# 
# Path: py3kwarn2to3/fixer_util.py
# def find_binding(name, node, package=None):
#     """ Returns the node which binds variable name, otherwise None.
#         If optional argument package is supplied, only imports will
#         be returned.
#         See test cases for examples."""
#     for child in node.children:
#         ret = None
#         if child.type == syms.for_stmt:
#             if _find(name, child.children[1]):
#                 return child
#             n = find_binding(name, make_suite(child.children[-1]), package)
#             if n: ret = n
#         elif child.type in (syms.if_stmt, syms.while_stmt):
#             n = find_binding(name, make_suite(child.children[-1]), package)
#             if n: ret = n
#         elif child.type == syms.try_stmt:
#             n = find_binding(name, make_suite(child.children[2]), package)
#             if n:
#                 ret = n
#             else:
#                 for i, kid in enumerate(child.children[3:]):
#                     if kid.type == token.COLON and kid.value == ":":
#                         # i+3 is the colon, i+4 is the suite
#                         n = find_binding(name, make_suite(child.children[i+4]), package)
#                         if n: ret = n
#         elif child.type in _def_syms and child.children[1].value == name:
#             ret = child
#         elif _is_import_binding(child, name, package):
#             ret = child
#         elif child.type == syms.simple_stmt:
#             ret = find_binding(name, child, package)
#         elif child.type == syms.expr_stmt:
#             if _find(name, child.children[0]):
#                 ret = child
# 
#         if ret:
#             if not package:
#                 return ret
#             if is_import(ret):
#                 return ret
#     return None
# 
# def is_probably_builtin(node):
#     """
#     Check that something isn't an attribute or function name etc.
#     """
#     prev = node.prev_sibling
#     if prev is not None and prev.type == token.DOT:
#         # Attribute lookup.
#         return False
#     parent = node.parent
#     if parent.type in (syms.funcdef, syms.classdef):
#         return False
#     if parent.type == syms.expr_stmt and parent.children[0] is node:
#         # Assignment.
#         return False
#     if parent.type == syms.parameters or \
#             (parent.type == syms.typedargslist and (
#             (prev is not None and prev.type == token.COMMA) or
#             parent.children[0] is node
#             )):
#         # The name of an argument.
#         return False
#     return True


from py3kwarn2to3 import fixer_base
from py3kwarn2to3.fixer_util import find_binding, is_probably_builtin
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.

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

# Local imports


class FixLong(fixer_base.BaseFix):
    BM_compatible = True
    PATTERN = "'long'"

    def start_tree(self, tree, filename):
        super(FixLong, self).start_tree(tree, filename)

# Path: py3kwarn2to3/fixer_base.py
# class BaseFix(object):
# class ConditionalFix(BaseFix):
#     PATTERN = None  # Most subclasses should override with a string literal
#             PC = PatternCompiler()
#     def __init__(self, options, log):
#     def compile_pattern(self):
#     def set_filename(self, filename):
#     def match(self, node):
#     def transform(self, node, results):
#     def new_name(self, template=u"xxx_todo_changeme"):
#     def log_message(self, message):
#     def cannot_convert(self, node, reason=None):
#     def warning(self, node, reason):
#     def start_tree(self, tree, filename):
#     def finish_tree(self, tree, filename):
#     def start_tree(self, *args):
#     def should_skip(self, node):
# 
# Path: py3kwarn2to3/fixer_util.py
# def find_binding(name, node, package=None):
#     """ Returns the node which binds variable name, otherwise None.
#         If optional argument package is supplied, only imports will
#         be returned.
#         See test cases for examples."""
#     for child in node.children:
#         ret = None
#         if child.type == syms.for_stmt:
#             if _find(name, child.children[1]):
#                 return child
#             n = find_binding(name, make_suite(child.children[-1]), package)
#             if n: ret = n
#         elif child.type in (syms.if_stmt, syms.while_stmt):
#             n = find_binding(name, make_suite(child.children[-1]), package)
#             if n: ret = n
#         elif child.type == syms.try_stmt:
#             n = find_binding(name, make_suite(child.children[2]), package)
#             if n:
#                 ret = n
#             else:
#                 for i, kid in enumerate(child.children[3:]):
#                     if kid.type == token.COLON and kid.value == ":":
#                         # i+3 is the colon, i+4 is the suite
#                         n = find_binding(name, make_suite(child.children[i+4]), package)
#                         if n: ret = n
#         elif child.type in _def_syms and child.children[1].value == name:
#             ret = child
#         elif _is_import_binding(child, name, package):
#             ret = child
#         elif child.type == syms.simple_stmt:
#             ret = find_binding(name, child, package)
#         elif child.type == syms.expr_stmt:
#             if _find(name, child.children[0]):
#                 ret = child
# 
#         if ret:
#             if not package:
#                 return ret
#             if is_import(ret):
#                 return ret
#     return None
# 
# def is_probably_builtin(node):
#     """
#     Check that something isn't an attribute or function name etc.
#     """
#     prev = node.prev_sibling
#     if prev is not None and prev.type == token.DOT:
#         # Attribute lookup.
#         return False
#     parent = node.parent
#     if parent.type in (syms.funcdef, syms.classdef):
#         return False
#     if parent.type == syms.expr_stmt and parent.children[0] is node:
#         # Assignment.
#         return False
#     if parent.type == syms.parameters or \
#             (parent.type == syms.typedargslist and (
#             (prev is not None and prev.type == token.COMMA) or
#             parent.children[0] is node
#             )):
#         # The name of an argument.
#         return False
#     return True


# Path: py3kwarn2to3/fixes/fix_long.py
from py3kwarn2to3 import fixer_base
from py3kwarn2to3.fixer_util import find_binding, is_probably_builtin

# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.

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

# Local imports


class FixLong(fixer_base.BaseFix):
    BM_compatible = True
    PATTERN = "'long'"

    def start_tree(self, tree, filename):
        super(FixLong, self).start_tree(tree, filename)

        self.skip = find_binding('long', tree)