o
    `^h»  ã                   @   s0   d Z dZdZG dd„ deƒZG dd„ deƒZdS )zº
Base classes for features that are backwards-incompatible.

Usage:
features = Features()
features.add(Feature("py3k_feature", "power< 'py3k' any* >", "2.7"))
PATTERN = features.PATTERN
z%s=%sz-
%s is only supported in Python %s and above.c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚFeaturez®
    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)ÚnameÚ_patternÚversion)Úselfr   ÚPATTERNr   © r   ú^/home/air/shanriGPT/back/venv/lib/python3.10/site-packages/libpasteurize/fixes/feature_base.pyÚ__init__   s   
zFeature.__init__c                 C   s   t | j| jf S )zS
        Format the above text with the name and minimum version required.
        )Úmessage_unformattedr   r   ©r   r   r   r   Úmessage_text   s   zFeature.message_textN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r   r   r   r   r   r      s    r   c                   @   s0   e Zd ZdZi Zdd„ Zedd„ ƒZdd„ ZdS )	ÚFeaturesz™
    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   s   t dd„ t| ƒD ƒƒ| _dS )zS
        Called every time we care about the mapping of names to features.
        c                 S   s   g | ]}|j |f‘qS r   )r   ©Ú.0Úfr   r   r   Ú
<listcomp>*   s    z+Features.update_mapping.<locals>.<listcomp>N)ÚdictÚiterÚmappingr   r   r   r   Úupdate_mapping&   s   zFeatures.update_mappingc                 C   s    |   ¡  d dd„ t| ƒD ƒ¡S )z{
        Uses the mapping of names to features to return a PATTERN suitable
        for using the lib2to3 patcomp.
        z |
c                 S   s   g | ]
}t |j|jf ‘qS r   )Úpattern_unformattedr   r   r   r   r   r   r   3   s    z$Features.PATTERN.<locals>.<listcomp>)r   Újoinr   r   r   r   r   r   ,   s   zFeatures.PATTERNc                 C   s
   | j | S )zH
        Implement a simple mapping to get patterns from names.
        )r   )r   Úkeyr   r   r   Ú__getitem__5   s   
zFeatures.__getitem__N)	r   r   r   r   r   r   Úpropertyr   r   r   r   r   r   r      s    
r   N)r   r   r
   Úobjectr   Úsetr   r   r   r   r   Ú<module>   s
    	