# 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/pytree.py
# HUGE = 0x7FFFFFFF  # maximum repeat count, default max
# def type_repr(type_num):
#     def __new__(cls, *args, **kwds):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def _eq(self, other):
#     def clone(self):
#     def post_order(self):
#     def pre_order(self):
#     def set_prefix(self, prefix):
#     def get_prefix(self):
#     def replace(self, new):
#     def get_lineno(self):
#     def changed(self):
#     def remove(self):
#     def next_sibling(self):
#     def prev_sibling(self):
#     def leaves(self):
#     def depth(self):
#     def get_suffix(self):
#         def __str__(self):
#     def __init__(self,type, children,
#                  context=None,
#                  prefix=None,
#                  fixers_applied=None):
#     def __repr__(self):
#     def __unicode__(self):
#     def _eq(self, other):
#     def clone(self):
#     def post_order(self):
#     def pre_order(self):
#     def _prefix_getter(self):
#     def _prefix_setter(self, prefix):
#     def set_child(self, i, child):
#     def insert_child(self, i, child):
#     def append_child(self, child):
#     def __init__(self, type, value,
#                  context=None,
#                  prefix=None,
#                  fixers_applied=[]):
#     def __repr__(self):
#     def __unicode__(self):
#     def _eq(self, other):
#     def clone(self):
#     def leaves(self):
#     def post_order(self):
#     def pre_order(self):
#     def _prefix_getter(self):
#     def _prefix_setter(self, prefix):
# def convert(gr, raw_node):
#     def __new__(cls, *args, **kwds):
#     def __repr__(self):
#     def optimize(self):
#     def match(self, node, results=None):
#     def match_seq(self, nodes, results=None):
#     def generate_matches(self, nodes):
#     def __init__(self, type=None, content=None, name=None):
#     def match(self, node, results=None):
#     def _submatch(self, node, results=None):
#     def __init__(self, type=None, content=None, name=None):
#     def _submatch(self, node, results=None):
#     def __init__(self, content=None, min=0, max=HUGE, name=None):
#     def optimize(self):
#     def match(self, node, results=None):
#     def match_seq(self, nodes, results=None):
#     def generate_matches(self, nodes):
#     def _iterative_matches(self, nodes):
#     def _bare_name_matches(self, nodes):
#     def _recursive_matches(self, nodes, count):
#     def __init__(self, content=None):
#     def match(self, node):
#     def match_seq(self, nodes):
#     def generate_matches(self, nodes):
# def generate_matches(patterns, nodes):
# class Base(object):
# class Node(Base):
# class Leaf(Base):
# class BasePattern(object):
# class LeafPattern(BasePattern):
# class NodePattern(BasePattern):
# class WildcardPattern(BasePattern):
# class NegatedPattern(BasePattern):
# 
# 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 py3kwarn2to3 import fixer_base, pytree
from py3kwarn2to3.fixer_util import token, syms
# Author: Benjamin Peterson



class FixSetLiteral(fixer_base.BaseFix):

    BM_compatible = True
    explicit = True

    PATTERN = """power< 'set' trailer< '('
                     (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) >
                                |
                                single=any) ']' >
                     |
                     atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' >
                     )
                     ')' > >
              """

    def transform(self, node, results):
        single = results.get("single")
        if single:
            # Make a fake listmaker
            fake = pytree.Node(syms.listmaker, [single.clone()])
            single.replace(fake)
            items = fake
        else:
            items = results["items"]

        # Build the contents of the literal

# 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/pytree.py
# HUGE = 0x7FFFFFFF  # maximum repeat count, default max
# def type_repr(type_num):
#     def __new__(cls, *args, **kwds):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def _eq(self, other):
#     def clone(self):
#     def post_order(self):
#     def pre_order(self):
#     def set_prefix(self, prefix):
#     def get_prefix(self):
#     def replace(self, new):
#     def get_lineno(self):
#     def changed(self):
#     def remove(self):
#     def next_sibling(self):
#     def prev_sibling(self):
#     def leaves(self):
#     def depth(self):
#     def get_suffix(self):
#         def __str__(self):
#     def __init__(self,type, children,
#                  context=None,
#                  prefix=None,
#                  fixers_applied=None):
#     def __repr__(self):
#     def __unicode__(self):
#     def _eq(self, other):
#     def clone(self):
#     def post_order(self):
#     def pre_order(self):
#     def _prefix_getter(self):
#     def _prefix_setter(self, prefix):
#     def set_child(self, i, child):
#     def insert_child(self, i, child):
#     def append_child(self, child):
#     def __init__(self, type, value,
#                  context=None,
#                  prefix=None,
#                  fixers_applied=[]):
#     def __repr__(self):
#     def __unicode__(self):
#     def _eq(self, other):
#     def clone(self):
#     def leaves(self):
#     def post_order(self):
#     def pre_order(self):
#     def _prefix_getter(self):
#     def _prefix_setter(self, prefix):
# def convert(gr, raw_node):
#     def __new__(cls, *args, **kwds):
#     def __repr__(self):
#     def optimize(self):
#     def match(self, node, results=None):
#     def match_seq(self, nodes, results=None):
#     def generate_matches(self, nodes):
#     def __init__(self, type=None, content=None, name=None):
#     def match(self, node, results=None):
#     def _submatch(self, node, results=None):
#     def __init__(self, type=None, content=None, name=None):
#     def _submatch(self, node, results=None):
#     def __init__(self, content=None, min=0, max=HUGE, name=None):
#     def optimize(self):
#     def match(self, node, results=None):
#     def match_seq(self, nodes, results=None):
#     def generate_matches(self, nodes):
#     def _iterative_matches(self, nodes):
#     def _bare_name_matches(self, nodes):
#     def _recursive_matches(self, nodes, count):
#     def __init__(self, content=None):
#     def match(self, node):
#     def match_seq(self, nodes):
#     def generate_matches(self, nodes):
# def generate_matches(patterns, nodes):
# class Base(object):
# class Node(Base):
# class Leaf(Base):
# class BasePattern(object):
# class LeafPattern(BasePattern):
# class NodePattern(BasePattern):
# class WildcardPattern(BasePattern):
# class NegatedPattern(BasePattern):
# 
# 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_set_literal.py
from py3kwarn2to3 import fixer_base, pytree
from py3kwarn2to3.fixer_util import token, syms

# Author: Benjamin Peterson



class FixSetLiteral(fixer_base.BaseFix):

    BM_compatible = True
    explicit = True

    PATTERN = """power< 'set' trailer< '('
                     (atom=atom< '[' (items=listmaker< any ((',' any)* [',']) >
                                |
                                single=any) ']' >
                     |
                     atom< '(' items=testlist_gexp< any ((',' any)* [',']) > ')' >
                     )
                     ')' > >
              """

    def transform(self, node, results):
        single = results.get("single")
        if single:
            # Make a fake listmaker
            fake = pytree.Node(syms.listmaker, [single.clone()])
            single.replace(fake)
            items = fake
        else:
            items = results["items"]

        # Build the contents of the literal

        literal = [pytree.Leaf(token.LBRACE, u"{")]