# Path: cinje/util.py
# def stream(input, encoding=None, errors='strict'):
# def flatten(input, file=None, encoding=None, errors='strict'):
# def fragment(string, name="anonymous", **context):
# def interruptable(iterable):
# def iterate(obj):
# def xmlargs(_source=None, **values):
# def chunk(line, mapping={None: 'text', '${': 'escape', '#{': 'bless', '&{': 'args', '%{': 'format', '@{': 'json'}):
# def ensure_buffer(context, separate=True):
# 	def __init__(self, number, line, scope=None, kind=None):
# 	def process(self):
# 	def stripped(self):
# 	def partitioned(self):
# 	def __repr__(self):
# 	def __bytes__(self):
# 	def __str__(self):
# 	def clone(self, **kw):
# 	def __init__(self, input=None, Line=Line):
# 	def count(self):
# 	def __len__(self):
# 	def __repr__(self):
# 	def __iter__(self):
# 	def __next__(self):
# 	def __str__(self):
# 	def next(self):
# 	def peek(self):
# 	def push(self, *lines):
# 	def reset(self):
# 	def append(self, *lines):
# 	def __init__(self, input):
# 	def __repr__(self):
# 	def prepare(self):
# 	def stream(self):
# 	def classify(self, line):
# 	def __init__(self, callable, *args, **kw):
# 	def __repr__(self):
# 	def __ror__(self, other):
# 	def __call__(self, *args, **kw):
# 	def __init__(self):
# 	def handle_data(self, d):
# 	def get_data(self):
# def strip_tags(html):
# class Line(object):
# class Lines(object):
# class Context(object):
# class Pipe(object):
# class MLStripper(HTMLParser):
# 
# Path: cinje/inline/flush.py
# def flush_template(context, declaration=None, reconstruct=True):
# 	"""Emit the code needed to flush the buffer.
# 		
# 	Will only emit the yield and clear if the buffer is known to be dirty.
# 	"""
# 	
# 	if declaration is None:
# 		declaration = Line(0, '')
# 	
# 	if {'text', 'dirty'}.issubset(context.flag):
# 		yield declaration.clone(line='yield "".join(_buffer)')
# 		
# 		context.flag.remove('text')  # This will force a new buffer to be constructed.
# 		context.flag.remove('dirty')
# 		
# 		if reconstruct:
# 			for i in ensure_buffer(context):
# 				yield i
# 	
# 	if declaration.stripped == 'yield':
# 		yield declaration


import re
from ..util import py, pypy, ensure_buffer
from ..inline.flush import flush_template
					continue
				
				if flag not in context.flag:
					context.flag.add(flag)
					added_flags.append(flag)
		
		if py == 3 and not pypy:
			argspec = self._optimize(context, argspec)
		
		# Reconstruct the line.
		
		line = 'def ' + name + '(' + argspec + '):'
		
		# yield declaration.clone(line='@cinje.Function.prepare')  # This lets us do some work before and after runtime.
		yield declaration.clone(line=line)
		
		context.scope += 1
		
		for i in ensure_buffer(context, False):
			yield i
		
		for i in context.stream:
			yield i
		
		if 'using' in context.flag:  # Clean up that we were using things.
			context.flag.remove('using')
		
		if 'text' in context.flag:
			context.templates.append(name)
		

# Path: cinje/util.py
# def stream(input, encoding=None, errors='strict'):
# def flatten(input, file=None, encoding=None, errors='strict'):
# def fragment(string, name="anonymous", **context):
# def interruptable(iterable):
# def iterate(obj):
# def xmlargs(_source=None, **values):
# def chunk(line, mapping={None: 'text', '${': 'escape', '#{': 'bless', '&{': 'args', '%{': 'format', '@{': 'json'}):
# def ensure_buffer(context, separate=True):
# 	def __init__(self, number, line, scope=None, kind=None):
# 	def process(self):
# 	def stripped(self):
# 	def partitioned(self):
# 	def __repr__(self):
# 	def __bytes__(self):
# 	def __str__(self):
# 	def clone(self, **kw):
# 	def __init__(self, input=None, Line=Line):
# 	def count(self):
# 	def __len__(self):
# 	def __repr__(self):
# 	def __iter__(self):
# 	def __next__(self):
# 	def __str__(self):
# 	def next(self):
# 	def peek(self):
# 	def push(self, *lines):
# 	def reset(self):
# 	def append(self, *lines):
# 	def __init__(self, input):
# 	def __repr__(self):
# 	def prepare(self):
# 	def stream(self):
# 	def classify(self, line):
# 	def __init__(self, callable, *args, **kw):
# 	def __repr__(self):
# 	def __ror__(self, other):
# 	def __call__(self, *args, **kw):
# 	def __init__(self):
# 	def handle_data(self, d):
# 	def get_data(self):
# def strip_tags(html):
# class Line(object):
# class Lines(object):
# class Context(object):
# class Pipe(object):
# class MLStripper(HTMLParser):
# 
# Path: cinje/inline/flush.py
# def flush_template(context, declaration=None, reconstruct=True):
# 	"""Emit the code needed to flush the buffer.
# 		
# 	Will only emit the yield and clear if the buffer is known to be dirty.
# 	"""
# 	
# 	if declaration is None:
# 		declaration = Line(0, '')
# 	
# 	if {'text', 'dirty'}.issubset(context.flag):
# 		yield declaration.clone(line='yield "".join(_buffer)')
# 		
# 		context.flag.remove('text')  # This will force a new buffer to be constructed.
# 		context.flag.remove('dirty')
# 		
# 		if reconstruct:
# 			for i in ensure_buffer(context):
# 				yield i
# 	
# 	if declaration.stripped == 'yield':
# 		yield declaration


# Path: cinje/block/function.py
import re
from ..util import py, pypy, ensure_buffer
from ..inline.flush import flush_template

					continue
				
				if flag not in context.flag:
					context.flag.add(flag)
					added_flags.append(flag)
		
		if py == 3 and not pypy:
			argspec = self._optimize(context, argspec)
		
		# Reconstruct the line.
		
		line = 'def ' + name + '(' + argspec + '):'
		
		# yield declaration.clone(line='@cinje.Function.prepare')  # This lets us do some work before and after runtime.
		yield declaration.clone(line=line)
		
		context.scope += 1
		
		for i in ensure_buffer(context, False):
			yield i
		
		for i in context.stream:
			yield i
		
		if 'using' in context.flag:  # Clean up that we were using things.
			context.flag.remove('using')
		
		if 'text' in context.flag:
			context.templates.append(name)
		

		for i in flush_template(context, reconstruct=False):  # Handle the final buffer yield if any content was generated.