# 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):


from zlib import compress
from base64 import b64encode
from collections import deque
from ..util import py, Line
	"""Module handler.
	
	This is the initial scope, and the highest priority to ensure its processing of the preamble happens first.
	"""
	
	priority = -100
	
	def match(self, context, line):
		return 'init' not in context.flag
	
	def __call__(self, context):
		input = context.input
		
		context.flag.add('init')
		context.flag.add('buffer')
		
		imported = False
		
		for line in input:
			if not line.stripped or line.stripped[0] == '#':
				if not line.stripped.startswith('##') and 'coding:' not in line.stripped:
					yield line
				continue
			
			input.push(line)  # We're out of the preamble, so put that line back and stop.
			break
		
		# After any existing preamble, but before other imports, we inject our own.
		
		if py == 2:

# 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/block/module.py
from zlib import compress
from base64 import b64encode
from collections import deque
from ..util import py, Line

	"""Module handler.
	
	This is the initial scope, and the highest priority to ensure its processing of the preamble happens first.
	"""
	
	priority = -100
	
	def match(self, context, line):
		return 'init' not in context.flag
	
	def __call__(self, context):
		input = context.input
		
		context.flag.add('init')
		context.flag.add('buffer')
		
		imported = False
		
		for line in input:
			if not line.stripped or line.stripped[0] == '#':
				if not line.stripped.startswith('##') and 'coding:' not in line.stripped:
					yield line
				continue
			
			input.push(line)  # We're out of the preamble, so put that line back and stop.
			break
		
		# After any existing preamble, but before other imports, we inject our own.
		
		if py == 2:

			yield Line(0, 'from __future__ import unicode_literals')