# Path: mako/pyparser.py
# def parse(code, mode='exec', **exception_kwargs):
#         def __init__(self, listener, **exception_kwargs):
#         def _add_declared(self, name):
#         def visit_ClassDef(self, node):
#         def visit_Assign(self, node):
#             def visit_ExceptHandler(self, node):
#         def visit_Lambda(self, node, *args):
#         def visit_FunctionDef(self, node):
#         def _visit_function(self, node, islambda):
#         def visit_For(self, node):
#         def visit_Name(self, node):
#         def visit_Import(self, node):
#         def visit_ImportFrom(self, node):
#         def __init__(self, listener, code_factory, **exception_kwargs):
#         def visit_Tuple(self, node):
#         def __init__(self, listener, **exception_kwargs):
#         def visit_FunctionDef(self, node):
#         def __init__(self, astnode):
#         def value(self):
#         def __init__(self, listener, **exception_kwargs):
#         def _add_declared(self, name):
#         def visitClass(self, node, *args):
#         def visitAssName(self, node, *args):
#         def visitAssign(self, node, *args):
#         def visitLambda(self, node, *args):
#         def visitFunction(self, node, *args):
#         def _visit_function(self, node, args):
#         def visitFor(self, node, *args):
#         def visitName(self, node, *args):
#         def visitImport(self, node, *args):
#         def visitFrom(self, node, *args):
#         def visit(self, expr):
#         def __init__(self, listener, code_factory, **exception_kwargs):
#         def visitTuple(self, node, *args):
#         def visit(self, expr):
#         def __init__(self, listener, **exception_kwargs):
#         def visitFunction(self, node, *args):
#         def visit(self, expr):
#         def __init__(self, astnode):
#         def value(self):
#         def operator(self, op, node, *args):
#         def booleanop(self, op, node, *args):
#         def visitConst(self, node, *args):
#         def visitAssName(self, node, *args):
#         def visitName(self, node, *args):
#         def visitMul(self, node, *args):
#         def visitAnd(self, node, *args):
#         def visitOr(self, node, *args):
#         def visitBitand(self, node, *args):
#         def visitBitor(self, node, *args):
#         def visitBitxor(self, node, *args):
#         def visitAdd(self, node, *args):
#         def visitGetattr(self, node, *args):
#         def visitSub(self, node, *args):
#         def visitNot(self, node, *args):
#         def visitDiv(self, node, *args):
#         def visitFloorDiv(self, node, *args):
#         def visitSubscript(self, node, *args):
#         def visitUnarySub(self, node, *args):
#         def visitUnaryAdd(self, node, *args):
#         def visitSlice(self, node, *args):
#         def visitDict(self, node):
#         def visitTuple(self, node):
#         def visitList(self, node):
#         def visitListComp(self, node):
#         def visitListCompFor(self, node):
#         def visitListCompIf(self, node):
#         def visitCompare(self, node):
#         def visitCallFunc(self, node, *args):
#         def dispatch(self, node, *args):
#     class FindIdentifiers(_ast_util.NodeVisitor):
#     class FindTuple(_ast_util.NodeVisitor):
#     class ParseFunc(_ast_util.NodeVisitor):
#     class ExpressionGenerator(object):
#     class FindIdentifiers(object):
#     class FindTuple(object):
#     class ParseFunc(object):
#     class ExpressionGenerator(object):
#     class walker(visitor.ASTVisitor):
# 
# Path: mako/util.py
# def function_named(fn, name):
#     def partial(func, *args, **keywords):
#         def newfunc(*fargs, **fkeywords):
#     def exception_name(exc):
#     def exception_name(exc):
# def verify_directory(dir):
# def to_list(x, default=None):
#     def __init__(self, fget, doc=None):
#     def __get__(self, obj, cls):
#     def union(self, other):
#     def __init__(self, encoding=None, errors='strict', str=False):
#     def truncate(self):
#     def getvalue(self):
#         def __init__(self, key, value):
#         def __repr__(self):
#     def __init__(self, capacity, threshold=.5):
#     def __getitem__(self, key):
#     def values(self):
#     def setdefault(self, key, value):
#     def __setitem__(self, key, value):
#     def _manage_size(self):
# def parse_encoding(fp):
# def sorted_dict_repr(d):
# def restore__ast(_ast):
#     def inspect_func_args(fn):
#     def inspect_func_args(fn):
# class memoized_property(object):
# class SetLikeDict(dict):
# class FastEncodingBuffer(object):
# class LRUCache(dict):
#     class _Item(object):


from mako import exceptions, pyparser, util
import re
    etc.
    """
    def __init__(self, code, **exception_kwargs):
        m = re.match(r'^(\w+)(?:\s+(.*?))?:\s*(#|$)', code.strip(), re.S)
        if not m:
            raise exceptions.CompileException(
                            "Fragment '%s' is not a partial control statement" % 
                            code, **exception_kwargs)
        if m.group(3):
            code = code[:m.start(3)]
        (keyword, expr) = m.group(1,2)
        if keyword in ['for','if', 'while']:
            code = code + "pass"
        elif keyword == 'try':
            code = code + "pass\nexcept:pass"
        elif keyword == 'elif' or keyword == 'else':
            code = "if False:pass\n" + code + "pass"
        elif keyword == 'except':
            code = "try:pass\n" + code + "pass"
        else:
            raise exceptions.CompileException(
                                "Unsupported control keyword: '%s'" % 
                                keyword, **exception_kwargs)
        super(PythonFragment, self).__init__(code, **exception_kwargs)
 
 
class FunctionDecl(object):
    """function declaration"""
    def __init__(self, code, allow_kwargs=True, **exception_kwargs):
        self.code = code

# Path: mako/pyparser.py
# def parse(code, mode='exec', **exception_kwargs):
#         def __init__(self, listener, **exception_kwargs):
#         def _add_declared(self, name):
#         def visit_ClassDef(self, node):
#         def visit_Assign(self, node):
#             def visit_ExceptHandler(self, node):
#         def visit_Lambda(self, node, *args):
#         def visit_FunctionDef(self, node):
#         def _visit_function(self, node, islambda):
#         def visit_For(self, node):
#         def visit_Name(self, node):
#         def visit_Import(self, node):
#         def visit_ImportFrom(self, node):
#         def __init__(self, listener, code_factory, **exception_kwargs):
#         def visit_Tuple(self, node):
#         def __init__(self, listener, **exception_kwargs):
#         def visit_FunctionDef(self, node):
#         def __init__(self, astnode):
#         def value(self):
#         def __init__(self, listener, **exception_kwargs):
#         def _add_declared(self, name):
#         def visitClass(self, node, *args):
#         def visitAssName(self, node, *args):
#         def visitAssign(self, node, *args):
#         def visitLambda(self, node, *args):
#         def visitFunction(self, node, *args):
#         def _visit_function(self, node, args):
#         def visitFor(self, node, *args):
#         def visitName(self, node, *args):
#         def visitImport(self, node, *args):
#         def visitFrom(self, node, *args):
#         def visit(self, expr):
#         def __init__(self, listener, code_factory, **exception_kwargs):
#         def visitTuple(self, node, *args):
#         def visit(self, expr):
#         def __init__(self, listener, **exception_kwargs):
#         def visitFunction(self, node, *args):
#         def visit(self, expr):
#         def __init__(self, astnode):
#         def value(self):
#         def operator(self, op, node, *args):
#         def booleanop(self, op, node, *args):
#         def visitConst(self, node, *args):
#         def visitAssName(self, node, *args):
#         def visitName(self, node, *args):
#         def visitMul(self, node, *args):
#         def visitAnd(self, node, *args):
#         def visitOr(self, node, *args):
#         def visitBitand(self, node, *args):
#         def visitBitor(self, node, *args):
#         def visitBitxor(self, node, *args):
#         def visitAdd(self, node, *args):
#         def visitGetattr(self, node, *args):
#         def visitSub(self, node, *args):
#         def visitNot(self, node, *args):
#         def visitDiv(self, node, *args):
#         def visitFloorDiv(self, node, *args):
#         def visitSubscript(self, node, *args):
#         def visitUnarySub(self, node, *args):
#         def visitUnaryAdd(self, node, *args):
#         def visitSlice(self, node, *args):
#         def visitDict(self, node):
#         def visitTuple(self, node):
#         def visitList(self, node):
#         def visitListComp(self, node):
#         def visitListCompFor(self, node):
#         def visitListCompIf(self, node):
#         def visitCompare(self, node):
#         def visitCallFunc(self, node, *args):
#         def dispatch(self, node, *args):
#     class FindIdentifiers(_ast_util.NodeVisitor):
#     class FindTuple(_ast_util.NodeVisitor):
#     class ParseFunc(_ast_util.NodeVisitor):
#     class ExpressionGenerator(object):
#     class FindIdentifiers(object):
#     class FindTuple(object):
#     class ParseFunc(object):
#     class ExpressionGenerator(object):
#     class walker(visitor.ASTVisitor):
# 
# Path: mako/util.py
# def function_named(fn, name):
#     def partial(func, *args, **keywords):
#         def newfunc(*fargs, **fkeywords):
#     def exception_name(exc):
#     def exception_name(exc):
# def verify_directory(dir):
# def to_list(x, default=None):
#     def __init__(self, fget, doc=None):
#     def __get__(self, obj, cls):
#     def union(self, other):
#     def __init__(self, encoding=None, errors='strict', str=False):
#     def truncate(self):
#     def getvalue(self):
#         def __init__(self, key, value):
#         def __repr__(self):
#     def __init__(self, capacity, threshold=.5):
#     def __getitem__(self, key):
#     def values(self):
#     def setdefault(self, key, value):
#     def __setitem__(self, key, value):
#     def _manage_size(self):
# def parse_encoding(fp):
# def sorted_dict_repr(d):
# def restore__ast(_ast):
#     def inspect_func_args(fn):
#     def inspect_func_args(fn):
# class memoized_property(object):
# class SetLikeDict(dict):
# class FastEncodingBuffer(object):
# class LRUCache(dict):
#     class _Item(object):


# Path: mako/ast.py
from mako import exceptions, pyparser, util
import re

    etc.
    """
    def __init__(self, code, **exception_kwargs):
        m = re.match(r'^(\w+)(?:\s+(.*?))?:\s*(#|$)', code.strip(), re.S)
        if not m:
            raise exceptions.CompileException(
                            "Fragment '%s' is not a partial control statement" % 
                            code, **exception_kwargs)
        if m.group(3):
            code = code[:m.start(3)]
        (keyword, expr) = m.group(1,2)
        if keyword in ['for','if', 'while']:
            code = code + "pass"
        elif keyword == 'try':
            code = code + "pass\nexcept:pass"
        elif keyword == 'elif' or keyword == 'else':
            code = "if False:pass\n" + code + "pass"
        elif keyword == 'except':
            code = "try:pass\n" + code + "pass"
        else:
            raise exceptions.CompileException(
                                "Unsupported control keyword: '%s'" % 
                                keyword, **exception_kwargs)
        super(PythonFragment, self).__init__(code, **exception_kwargs)
 
 
class FunctionDecl(object):
    """function declaration"""
    def __init__(self, code, allow_kwargs=True, **exception_kwargs):
        self.code = code

        expr = pyparser.parse(code, "exec", **exception_kwargs)