<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import , unicode_literals <EOL> from django import template <EOL> def _parse_args ( argstr , context = None ) : <EOL> try : <EOL> args = { } <EOL> for token in argstr . split ( '<STR_LIT:U+002C>' ) : <EOL> if '<STR_LIT:=>' in token : <EOL> k , v = token . split ( '<STR_LIT:=>' , <NUM_LIT:1> ) <EOL> if context : <EOL> try : <EOL> args [ k ] = template . Variable ( v ) . resolve ( context ) <EOL> except template . VariableDoesNotExist : <EOL> args [ k ] = v <EOL> else : <EOL> args [ k ] = v <EOL> else : <EOL> args [ token ] = True <EOL> return args <EOL> except TypeError : <EOL> raise template . TemplateSyntaxError ( '<STR_LIT>' ) <EOL> def do_simple_node_with_var_and_args_helper ( cls ) : <EOL> def _func ( parser , token ) : <EOL> try : <EOL> tag_name , of_ , in_var_name , args = token . contents . split ( ) <EOL> except ValueError : <EOL> try : <EOL> tag_name , of_ , in_var_name = token . contents . split ( ) <EOL> args = '<STR_LIT>' <EOL> except ValueError : <EOL> raise template . TemplateSyntaxError ( <EOL> '<STR_LIT>' % ( <EOL> cls . __name__ , token . contents ) ) <EOL> return cls ( tag_name , in_var_name , args ) <EOL> return _func <EOL> class SimpleNodeWithVarAndArgs ( template . Node ) : <EOL> def __init__ ( self , tag_name , in_var_name , args ) : <EOL> self . tag_name = tag_name <EOL> self . in_var = template . Variable ( in_var_name ) <EOL> self . args = args <EOL> def render ( self , context ) : <EOL> self . render_context = context <EOL> try : <EOL> instance = self . in_var . resolve ( context ) <EOL> except template . VariableDoesNotExist : <EOL> return '<STR_LIT>' <EOL> return self . what ( instance , _parse_args ( self . args , context ) ) <EOL> def do_simple_assignment_node_with_var_and_args_helper ( cls ) : <EOL> def _func ( parser , token ) : <EOL> try : <EOL> tag_name , of_ , in_var_name , as_ , var_name , args = token . contents . split ( ) <EOL> except ValueError : <EOL> try : <EOL> tag_name , of_ , in_var_name , as_ , var_name = token . contents . split ( ) <EOL> args = '<STR_LIT>' <EOL> except ValueError : <EOL> raise template . TemplateSyntaxError ( <EOL> '<STR_LIT>' % ( <EOL> cls . __name__ , token . contents ) ) <EOL> return cls ( tag_name , in_var_name , var_name , args ) <EOL> return _func <EOL> class SimpleAssignmentNodeWithVarAndArgs ( template . Node ) : <EOL> def __init__ ( self , tag_name , in_var_name , var_name , args ) : <EOL> self . tag_name = tag_name <EOL> self . in_var = template . Variable ( in_var_name ) <EOL> self . var_name = var_name <EOL> self . args = args <EOL> def render ( self , context ) : <EOL> self . render_context = context <EOL> try : <EOL> instance = self . in_var . resolve ( context ) <EOL> except template . VariableDoesNotExist : <EOL> context [ self . var_name ] = [ ] <EOL> return '<STR_LIT>' <EOL> context [ self . var_name ] = self . what ( <EOL> instance , _parse_args ( self . args , context ) ) <EOL> return '<STR_LIT>' </s>
