parameters: (self, stream, name=None, filename=None)
docstring: This is called with the stream as returned by `tokenize` and wraps
          every token in a :class:`Token` and converts the value.
docstring_summary: This is called with the stream as returned by `tokenize` and wraps
          every token in a :class:`Token` and converts the value.
docstring_tokens: This is called with the stream as returned by tokenize and wraps every token in a : class : Token and converts the value .
function: def wrap(self, stream, name=None, filename=None):
          """This is called with the stream as returned by `tokenize` and wraps
          every token in a :class:`Token` and converts the value.
          """
          for lineno, token, value in stream:
              if token in ignored_tokens:
                  continue
              elif token == 'linestatement_begin':
                  token = 'block_begin'
              elif token == 'linestatement_end':
                  token = 'block_end'
              # we are not interested in those tokens in the parser
              elif token in ('raw_begin', 'raw_end'):
                  continue
              elif token == 'data':
                  value = self._normalize_newlines(value)
              elif token == 'keyword':
                  token = value
              elif token == 'name':
                  value = str(value)
                  if check_ident and not value.isidentifier():
                      raise TemplateSyntaxError(
                          'Invalid character in identifier',
                          lineno, name, filename)
              elif token == 'string':
                  # try to unescape string
                  try:
                      value = self._normalize_newlines(value[1:-1]) \
                          .encode('ascii', 'backslashreplace') \
                          .decode('unicode-escape')
                  except Exception as e:
                      msg = str(e).split(':')[-1].strip()
                      raise TemplateSyntaxError(msg, lineno, name, filename)
              elif token == 'integer':
                  value = int(value)
              elif token == 'float':
                  value = float(value)
              elif token == 'operator':
                  token = operators[value]
              yield Token(lineno, token, value)
function_tokens: def wrap ( self , stream , name = None , filename = None ) : for lineno , token , value in stream : if token in ignored_tokens : continue elif token == 'linestatement_begin' : token = 'block_begin' elif token == 'linestatement_end' : token = 'block_end' # we are not interested in those tokens in the parser elif token in ( 'raw_begin' , 'raw_end' ) : continue elif token == 'data' : value = self . _normalize_newlines ( value ) elif token == 'keyword' : token = value elif token == 'name' : value = str ( value ) if check_ident and not value . isidentifier ( ) : raise TemplateSyntaxError ( 'Invalid character in identifier' , lineno , name , filename ) elif token == 'string' : # try to unescape string try : value = self . _normalize_newlines ( value [ 1 : - 1 ] ) . encode ( 'ascii' , 'backslashreplace' ) . decode ( 'unicode-escape' ) except Exception as e : msg = str ( e ) . split ( ':' ) [ - 1 ] . strip ( ) raise TemplateSyntaxError ( msg , lineno , name , filename ) elif token == 'integer' : value = int ( value ) elif token == 'float' : value = float ( value ) elif token == 'operator' : token = operators [ value ] yield Token ( lineno , token , value )