# Path: bustard/constants.py
# TEMPLATE_BUILTIN_FUNC_WHITELIST = (
#     'all',
#     'unicode',
#     'isinstance',
#     'dict',
#     'format',
#     'repr',
#     'sorted',
#     'list',
#     'iter',
#     'round',
#     'cmp',
#     'set',
#     'bytes',
#     'reduce',
#     'slice',
#     'sum',
#     'getattr',
#     'abs',
#     'hash',
#     'len',
#     'ord',
#     'filter',
#     'range',
#     'pow',
#     'float',
#     'divmod',
#     'enumerate',
#     'basestring',
#     'zip',
#     'hex',
#     'long',
#     'next',
#     'chr',
#     'xrange',
#     'type',
#     'tuple',
#     'reversed',
#     'hasattr',
#     'delattr',
#     'setattr',
#     'str',
#     'int',
#     'unichr',
#     'min',
#     'any',
#     'complex',
#     'bool',
#     'map',
#     'max',
#     'object',
#     'callable',
# )
# 
# Path: bustard/utils.py
# def to_text(st, encoding='utf-8'):
#     if isinstance(st, str):
#         return st
#     elif isinstance(st, collections.ByteString):
#         return st.decode(encoding)
#     else:
#         return str(st)


import builtins
import os
import re
from .constants import TEMPLATE_BUILTIN_FUNC_WHITELIST
from .utils import to_text

    def backward_indent(self):
        self.indent_level -= self.INDENT_STEP

    def _compile(self):
        assert self.indent_level == 0
        self._code = compile(str(self), '<source>', 'exec')
        return self._code

    def _exec(self, globals_dict=None):
        """exec compiled code"""
        globals_dict = globals_dict or {}
        globals_dict.setdefault('__builtins__', {})
        exec(self._code, globals_dict)
        return globals_dict

    def __str__(self):
        return ''.join(map(str, self.source_code))

    def __repr__(self):
        return self.__str__()


class Template:
    TOKEN_VARIABLE_START = '{{'
    TOKEN_VARIABLE_END = '}}'
    TOKEN_TAG_START = '{%'
    TOKEN_TAG_END = '%}'
    TOKEN_COMMENT_START = '{#'
    TOKEN_COMMENT_END = '#}'

# Path: bustard/constants.py
# TEMPLATE_BUILTIN_FUNC_WHITELIST = (
#     'all',
#     'unicode',
#     'isinstance',
#     'dict',
#     'format',
#     'repr',
#     'sorted',
#     'list',
#     'iter',
#     'round',
#     'cmp',
#     'set',
#     'bytes',
#     'reduce',
#     'slice',
#     'sum',
#     'getattr',
#     'abs',
#     'hash',
#     'len',
#     'ord',
#     'filter',
#     'range',
#     'pow',
#     'float',
#     'divmod',
#     'enumerate',
#     'basestring',
#     'zip',
#     'hex',
#     'long',
#     'next',
#     'chr',
#     'xrange',
#     'type',
#     'tuple',
#     'reversed',
#     'hasattr',
#     'delattr',
#     'setattr',
#     'str',
#     'int',
#     'unichr',
#     'min',
#     'any',
#     'complex',
#     'bool',
#     'map',
#     'max',
#     'object',
#     'callable',
# )
# 
# Path: bustard/utils.py
# def to_text(st, encoding='utf-8'):
#     if isinstance(st, str):
#         return st
#     elif isinstance(st, collections.ByteString):
#         return st.decode(encoding)
#     else:
#         return str(st)


# Path: bustard/template.py
import builtins
import os
import re
from .constants import TEMPLATE_BUILTIN_FUNC_WHITELIST
from .utils import to_text


    def backward_indent(self):
        self.indent_level -= self.INDENT_STEP

    def _compile(self):
        assert self.indent_level == 0
        self._code = compile(str(self), '<source>', 'exec')
        return self._code

    def _exec(self, globals_dict=None):
        """exec compiled code"""
        globals_dict = globals_dict or {}
        globals_dict.setdefault('__builtins__', {})
        exec(self._code, globals_dict)
        return globals_dict

    def __str__(self):
        return ''.join(map(str, self.source_code))

    def __repr__(self):
        return self.__str__()


class Template:
    TOKEN_VARIABLE_START = '{{'
    TOKEN_VARIABLE_END = '}}'
    TOKEN_TAG_START = '{%'
    TOKEN_TAG_END = '%}'
    TOKEN_COMMENT_START = '{#'
    TOKEN_COMMENT_END = '#}'

    FUNC_WHITELIST = TEMPLATE_BUILTIN_FUNC_WHITELIST