ó
	Q[c           @   sB   d  Z  d Z d Z d e f d     YZ d e f d     YZ d S(   uš   
Base classes for features that are backwards-incompatible.

Usage:
features = Features()
features.add(Feature("py3k_feature", "power< 'py3k' any* >", "2.7"))
PATTERN = features.PATTERN
u   %s=%su-   
%s is only supported in Python %s and above.t   Featurec           B   s    e  Z d  Z d   Z d   Z RS(   uŪ   
    A feature has a name, a pattern, and a minimum version of Python 2.x
    required to use the feature (or 3.x if there is no backwards-compatible
    version of 2.x)
    c         C   s   | |  _  | |  _ | |  _ d  S(   N(   t   namet   _patternt   version(   t   selfR   t   PATTERNR   (    (    s?   lib/python2.7/site-packages/libpasteurize/fixes/feature_base.pyt   __init__   s    		c         C   s   t  |  j |  j f S(   uS   
        Format the above text with the name and minimum version required.
        (   t   message_unformattedR   R   (   R   (    (    s?   lib/python2.7/site-packages/libpasteurize/fixes/feature_base.pyt   message_text   s    (   t   __name__t
   __module__t   __doc__R   R   (    (    (    s?   lib/python2.7/site-packages/libpasteurize/fixes/feature_base.pyR       s   	t   Featuresc           B   s5   e  Z d  Z i  Z d   Z e d    Z d   Z RS(   u   
    A set of features that generates a pattern for the features it contains.
    This set will act like a mapping in that we map names to patterns.
    c         C   s5   t  g  t |   D] } | j | f ^ q  |  _ d S(   uS   
        Called every time we care about the mapping of names to features.
        N(   t   dictt   iterR   t   mapping(   R   t   f(    (    s?   lib/python2.7/site-packages/libpasteurize/fixes/feature_base.pyt   update_mapping&   s    c         C   s@   |  j    d j g  t |   D] } t | j | j f ^ q  S(   u{   
        Uses the mapping of names to features to return a PATTERN suitable
        for using the lib2to3 patcomp.
        u    |
(   R   t   joinR   t   pattern_unformattedR   R   (   R   R   (    (    s?   lib/python2.7/site-packages/libpasteurize/fixes/feature_base.pyR   ,   s    
c         C   s   |  j  | S(   uH   
        Implement a simple mapping to get patterns from names.
        (   R   (   R   t   key(    (    s?   lib/python2.7/site-packages/libpasteurize/fixes/feature_base.pyt   __getitem__5   s    (   R	   R
   R   R   R   t   propertyR   R   (    (    (    s?   lib/python2.7/site-packages/libpasteurize/fixes/feature_base.pyR      s
   		N(   R   R   R   t   objectR    t   setR   (    (    (    s?   lib/python2.7/site-packages/libpasteurize/fixes/feature_base.pyt   <module>   s   