# Path: py3kwarn2to3/fixer_util.py
# def Name(name, prefix=None):
#     """Return a NAME leaf"""
#     return Leaf(token.NAME, name, prefix=prefix)
# 
# def Call(func_name, args=None, prefix=None):
#     """A function call"""
#     node = Node(syms.power, [func_name, ArgList(args)])
#     if prefix is not None:
#         node.prefix = prefix
#     return node
# 
# def Comma():
#     """A comma leaf"""
#     return Leaf(token.COMMA, u",")
# 
# def String(string, prefix=None):
#     """A string leaf"""
#     return Leaf(token.STRING, string, prefix=prefix)


from .. import patcomp
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Name, Call, Comma, String
    'print ... ,'    into 'print(..., end=" ")'
    'print >>x, ...' into 'print(..., file=x)'

No changes are applied if print_function is imported from __future__

"""

# Local imports


parend_expr = patcomp.compile_pattern(
      """atom< '(' [arith_expr|atom|power|term|STRING|NAME] ')' >"""
)


class FixPrint(fixer_base.BaseFix):

    BM_compatible = True

    PATTERN = """
              simple_stmt< any* bare='print' any* > | print_stmt
              """

    def transform(self, node, results):
        assert results

        bare_print = results.get("bare")

        if bare_print:
            # Special-case print all by itself

# Path: py3kwarn2to3/fixer_util.py
# def Name(name, prefix=None):
#     """Return a NAME leaf"""
#     return Leaf(token.NAME, name, prefix=prefix)
# 
# def Call(func_name, args=None, prefix=None):
#     """A function call"""
#     node = Node(syms.power, [func_name, ArgList(args)])
#     if prefix is not None:
#         node.prefix = prefix
#     return node
# 
# def Comma():
#     """A comma leaf"""
#     return Leaf(token.COMMA, u",")
# 
# def String(string, prefix=None):
#     """A string leaf"""
#     return Leaf(token.STRING, string, prefix=prefix)


# Path: py3kwarn2to3/fixes/fix_print.py
from .. import patcomp
from .. import pytree
from ..pgen2 import token
from .. import fixer_base
from ..fixer_util import Name, Call, Comma, String

    'print ... ,'    into 'print(..., end=" ")'
    'print >>x, ...' into 'print(..., file=x)'

No changes are applied if print_function is imported from __future__

"""

# Local imports


parend_expr = patcomp.compile_pattern(
      """atom< '(' [arith_expr|atom|power|term|STRING|NAME] ')' >"""
)


class FixPrint(fixer_base.BaseFix):

    BM_compatible = True

    PATTERN = """
              simple_stmt< any* bare='print' any* > | print_stmt
              """

    def transform(self, node, results):
        assert results

        bare_print = results.get("bare")

        if bare_print:
            # Special-case print all by itself

            bare_print.replace(Call(Name(u"print"), [],