# Path: py3kwarn2to3/fixer_util.py
# def KeywordArg(keyword, value):
# def LParen():
# def RParen():
# def Assign(target, source):
# def Name(name, prefix=None):
# def Attr(obj, attr):
# def Comma():
# def Dot():
# def ArgList(args, lparen=LParen(), rparen=RParen()):
# def Call(func_name, args=None, prefix=None):
# def Newline():
# def BlankLine():
# def Number(n, prefix=None):
# def Subscript(index_node):
# def String(string, prefix=None):
# def ListComp(xp, fp, it, test=None):
# def FromImport(package_name, name_leafs):
# def is_tuple(node):
# def is_list(node):
# def parenthesize(node):
# def attr_chain(obj, attr):
# def in_special_context(node):
# def is_probably_builtin(node):
# def find_indentation(node):
# def make_suite(node):
# def find_root(node):
# def does_tree_import(package, name, node):
# def is_import(node):
# def touch_import(package, name, node):
#     def is_import_stmt(node):
# def find_binding(name, node, package=None):
# def _find(name, node):
# def _is_import_binding(node, name, package=None):
# 
# Path: py3kwarn2to3/fixer_util.py
# def KeywordArg(keyword, value):
# def LParen():
# def RParen():
# def Assign(target, source):
# def Name(name, prefix=None):
# def Attr(obj, attr):
# def Comma():
# def Dot():
# def ArgList(args, lparen=LParen(), rparen=RParen()):
# def Call(func_name, args=None, prefix=None):
# def Newline():
# def BlankLine():
# def Number(n, prefix=None):
# def Subscript(index_node):
# def String(string, prefix=None):
# def ListComp(xp, fp, it, test=None):
# def FromImport(package_name, name_leafs):
# def is_tuple(node):
# def is_list(node):
# def parenthesize(node):
# def attr_chain(obj, attr):
# def in_special_context(node):
# def is_probably_builtin(node):
# def find_indentation(node):
# def make_suite(node):
# def find_root(node):
# def does_tree_import(package, name, node):
# def is_import(node):
# def touch_import(package, name, node):
#     def is_import_stmt(node):
# def find_binding(name, node, package=None):
# def _find(name, node):
# def _is_import_binding(node, name, package=None):
# 
# Path: py3kwarn2to3/fixer_util.py
# def KeywordArg(keyword, value):
# def LParen():
# def RParen():
# def Assign(target, source):
# def Name(name, prefix=None):
# def Attr(obj, attr):
# def Comma():
# def Dot():
# def ArgList(args, lparen=LParen(), rparen=RParen()):
# def Call(func_name, args=None, prefix=None):
# def Newline():
# def BlankLine():
# def Number(n, prefix=None):
# def Subscript(index_node):
# def String(string, prefix=None):
# def ListComp(xp, fp, it, test=None):
# def FromImport(package_name, name_leafs):
# def is_tuple(node):
# def is_list(node):
# def parenthesize(node):
# def attr_chain(obj, attr):
# def in_special_context(node):
# def is_probably_builtin(node):
# def find_indentation(node):
# def make_suite(node):
# def find_root(node):
# def does_tree_import(package, name, node):
# def is_import(node):
# def touch_import(package, name, node):
#     def is_import_stmt(node):
# def find_binding(name, node, package=None):
# def _find(name, node):
# def _is_import_binding(node, name, package=None):


from .. import fixer_base
from ..pgen2 import token
from ..fixer_util import syms
from ..fixer_util import Node
from ..fixer_util import Leaf
"""Fixer for __metaclass__ = X -> (metaclass=X) methods.

   The various forms of classef (inherits nothing, inherits once, inherints
   many) don't parse the same in the CST so we look at ALL classes for
   a __metaclass__ and if we find one normalize the inherits to all be
   an arglist.

   For one-liner classes ('class X: pass') there is no indent/dedent so
   we normalize those into having a suite.

   Moving the __metaclass__ into the classdef can also cause the class
   body to be empty so there is some special casing for that as well.

   This fixer also tries very hard to keep original indenting and spacing
   in all those corner cases.

"""
# Author: Jack Diederich

# Local imports


def has_metaclass(parent):
    """ we have to check the cls_node without changing it.
        There are two possibilities:
          1)  clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
          2)  clsdef => simple_stmt => expr_stmt => Leaf('__meta')
    """
    for node in parent.children:

# Path: py3kwarn2to3/fixer_util.py
# def KeywordArg(keyword, value):
# def LParen():
# def RParen():
# def Assign(target, source):
# def Name(name, prefix=None):
# def Attr(obj, attr):
# def Comma():
# def Dot():
# def ArgList(args, lparen=LParen(), rparen=RParen()):
# def Call(func_name, args=None, prefix=None):
# def Newline():
# def BlankLine():
# def Number(n, prefix=None):
# def Subscript(index_node):
# def String(string, prefix=None):
# def ListComp(xp, fp, it, test=None):
# def FromImport(package_name, name_leafs):
# def is_tuple(node):
# def is_list(node):
# def parenthesize(node):
# def attr_chain(obj, attr):
# def in_special_context(node):
# def is_probably_builtin(node):
# def find_indentation(node):
# def make_suite(node):
# def find_root(node):
# def does_tree_import(package, name, node):
# def is_import(node):
# def touch_import(package, name, node):
#     def is_import_stmt(node):
# def find_binding(name, node, package=None):
# def _find(name, node):
# def _is_import_binding(node, name, package=None):
# 
# Path: py3kwarn2to3/fixer_util.py
# def KeywordArg(keyword, value):
# def LParen():
# def RParen():
# def Assign(target, source):
# def Name(name, prefix=None):
# def Attr(obj, attr):
# def Comma():
# def Dot():
# def ArgList(args, lparen=LParen(), rparen=RParen()):
# def Call(func_name, args=None, prefix=None):
# def Newline():
# def BlankLine():
# def Number(n, prefix=None):
# def Subscript(index_node):
# def String(string, prefix=None):
# def ListComp(xp, fp, it, test=None):
# def FromImport(package_name, name_leafs):
# def is_tuple(node):
# def is_list(node):
# def parenthesize(node):
# def attr_chain(obj, attr):
# def in_special_context(node):
# def is_probably_builtin(node):
# def find_indentation(node):
# def make_suite(node):
# def find_root(node):
# def does_tree_import(package, name, node):
# def is_import(node):
# def touch_import(package, name, node):
#     def is_import_stmt(node):
# def find_binding(name, node, package=None):
# def _find(name, node):
# def _is_import_binding(node, name, package=None):
# 
# Path: py3kwarn2to3/fixer_util.py
# def KeywordArg(keyword, value):
# def LParen():
# def RParen():
# def Assign(target, source):
# def Name(name, prefix=None):
# def Attr(obj, attr):
# def Comma():
# def Dot():
# def ArgList(args, lparen=LParen(), rparen=RParen()):
# def Call(func_name, args=None, prefix=None):
# def Newline():
# def BlankLine():
# def Number(n, prefix=None):
# def Subscript(index_node):
# def String(string, prefix=None):
# def ListComp(xp, fp, it, test=None):
# def FromImport(package_name, name_leafs):
# def is_tuple(node):
# def is_list(node):
# def parenthesize(node):
# def attr_chain(obj, attr):
# def in_special_context(node):
# def is_probably_builtin(node):
# def find_indentation(node):
# def make_suite(node):
# def find_root(node):
# def does_tree_import(package, name, node):
# def is_import(node):
# def touch_import(package, name, node):
#     def is_import_stmt(node):
# def find_binding(name, node, package=None):
# def _find(name, node):
# def _is_import_binding(node, name, package=None):


# Path: py3kwarn2to3/fixes/fix_metaclass.py
from .. import fixer_base
from ..pgen2 import token
from ..fixer_util import syms
from ..fixer_util import Node
from ..fixer_util import Leaf

"""Fixer for __metaclass__ = X -> (metaclass=X) methods.

   The various forms of classef (inherits nothing, inherits once, inherints
   many) don't parse the same in the CST so we look at ALL classes for
   a __metaclass__ and if we find one normalize the inherits to all be
   an arglist.

   For one-liner classes ('class X: pass') there is no indent/dedent so
   we normalize those into having a suite.

   Moving the __metaclass__ into the classdef can also cause the class
   body to be empty so there is some special casing for that as well.

   This fixer also tries very hard to keep original indenting and spacing
   in all those corner cases.

"""
# Author: Jack Diederich

# Local imports


def has_metaclass(parent):
    """ we have to check the cls_node without changing it.
        There are two possibilities:
          1)  clsdef => suite => simple_stmt => expr_stmt => Leaf('__meta')
          2)  clsdef => simple_stmt => expr_stmt => Leaf('__meta')
    """
    for node in parent.children:

        if node.type == syms.suite: