;ò
3¼»=c           @   sA   d  Z  d k Z d „  Z d „  Z d „  Z d f  d „  ƒ  YZ d S(   s]  Module: template

Substrings of the form <identifier> are replaced by %(identifier)s
during calls to "dirty()".  Calls to "clean()" do the reverse, replacing
%(var)s with <var>.

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.

Nc         C   s)   t  |  ƒ i ƒ  } t i d d | ƒ Sd S(   s(   replaces instances of %(var)s with <var>s   %\((\w+)\)ss   <\1>N(   s   opens   fs   reads   ss   res   sub(   s   fs   s(    (    sJ   /mit/python/arch/i386_rh9/lib/python2.3/site-packages/numarray/template.pys   clean   s     c         C   s   t  i d d |  ƒ Sd S(   s(   replaces instances of <var> with %(var)ss   <(\w+)>s   %(\1)sN(   s   res   subs   s(   s   s(    (    sJ   /mit/python/arch/i386_rh9/lib/python2.3/site-packages/numarray/template.pys   dirty   s     c         C   s   xx |  i ƒ  D]j } t |  | ƒ t d ƒ j o t |  | ƒ |  | <q t |  | ƒ t |  ƒ j o t |  | ƒ q q Wd S(   sT   sugar_dict does <var> to %(var)s translation on all values
    in a dictionary.
    s    N(   s   ds   keyss   ks   types   dirtys
   sugar_dict(   s   ds   k(    (    sJ   /mit/python/arch/i386_rh9/lib/python2.3/site-packages/numarray/template.pys
   sugar_dict   s      s   Templatec           B   s   t  Z d „  Z d „  Z RS(   Nc         K   s   | |  _ |  i i | ƒ d  S(   N(   s   patterns   selfs   _patterns   __dict__s   updates   values(   s   selfs   patterns   values(    (    sJ   /mit/python/arch/i386_rh9/lib/python2.3/site-packages/numarray/template.pys   __init__'   s    	c         C   sW   t  |  i ƒ |  i } d } x4 n o, | } | |  i } | | j o | Sq q& Wd S(   sµ   
        Instantiation of a template iterates until the resulting
        string no longer changes.

        Prior to instantiation, all template variables must be defined.
        i    i   N(   s
   sugar_dicts   selfs   __dict__s   _patterns   ss   is   old_s(   s   selfs   is   old_ss   s(    (    sJ   /mit/python/arch/i386_rh9/lib/python2.3/site-packages/numarray/template.pys   __str__+   s     	 (   s   __name__s
   __module__s   __init__s   __str__(    (    (    sJ   /mit/python/arch/i386_rh9/lib/python2.3/site-packages/numarray/template.pys   Template&   s   	(   s   __doc__s   res   cleans   dirtys
   sugar_dicts   Template(   s   res   Templates
   sugar_dicts   dirtys   clean(    (    sJ   /mit/python/arch/i386_rh9/lib/python2.3/site-packages/numarray/template.pys   ?   s
   				
