;ò a~dAc@sAdZdkZd„Zd„Zd„Zdfd„ƒYZdS(s]Module: template Substrings of the form are replaced by %(identifier)s during calls to "dirty()". Calls to "clean()" do the reverse, replacing %(var)s with . sugar_dict is typically called on the dictionary of a module (globals()) and mutates the module's global strings and dictionaries. Template declares a string template which does iterative variable substitution when str() is called. In a Template, both the initial string, and the variable values can contain variables. Prior to instantiation of a template, all variable values must be defined in the templates dictionary. NcCs)t|ƒiƒ}tidd|ƒSdS(s(replaces instances of %(var)s with s %\((\w+)\)ss<\1>N(sopensfsreadsssressub(sfss((sLib/codegenerator/template.pyscleanscCstidd|ƒSdS(s(replaces instances of with %(var)ss<(\w+)>s%(\1)sN(sressubss(ss((sLib/codegenerator/template.pysdirtyscCsxx|iƒD]j}t||ƒtdƒjot||ƒ|| to %(var)s translation on all values in a dictionary. sN(sdskeysskstypesdirtys sugar_dict(sdsk((sLib/codegenerator/template.pys sugar_dicts sTemplatecBstZd„Zd„ZRS(NcKs||_|ii|ƒdS(N(spatternsselfs_patterns__dict__supdatesvalues(sselfspatternsvalues((sLib/codegenerator/template.pys__init__'s cCsmt|iƒ|i}d}x1no)|}||i}||joPqq&Wtidd|ƒ}|SdS(sµ Instantiation of a template iterates until the resulting string no longer changes. Prior to instantiation, all template variables must be defined. iis@mod@s%N( s sugar_dictsselfs__dict__s_patternsssisold_ssressub(sselfsisold_sss((sLib/codegenerator/template.pys__str__+s     (s__name__s __module__s__init__s__str__(((sLib/codegenerator/template.pysTemplate&s (s__doc__srescleansdirtys sugar_dictsTemplate(sresTemplates sugar_dictsdirtysclean((sLib/codegenerator/template.pys?s