B
    Khh=              !   @   sr  U d Z ddlZddlmZmZ ddlmZmZ ddlm	Z	 ddl
mZ ddlmZmZ ddlmZ ejd	k rzdd
lmZ ndd
lmZ ddlmZ G dd deZG dd deZdejiZeed< ejejhejejhejejejhej ej!ej"ejej#ejhej$ej!ej"ejej#ej%ejhej&ej!ej'ej"ejej#ej%ejej(ej)ej*ej+hej,ej!ej'ej"ejej#ej%ejej(ej-ej)ej*ej+ej.hej/ej!ej'ej"ejej#ej%ejej(ej-ej)ej*ej+ej.ej0hej1ej!ej'ej"ejej#ej%ejej(ej-ej)ej*ej+ej.ej0ej2ej3hi	Z4eeee f ed< ee ee5dddZ6G dd deZ7G dd de8Z9eG dd dZ:dS )zData structures configuring Black behavior.

Mostly around Python language feature support per version and Black configuration
chosen by the user.
    N)	dataclassfield)Enumauto)sha256)
attrgetter)DictSet)warn)      )Final)DEFAULT_LINE_LENGTHc               @   s0   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
S )TargetVersionr               r   	   
      N)__name__
__module____qualname__PY33PY34PY35PY36PY37PY38PY39PY310PY311 r#   r#   -/tmp/pip-install-vv81h98y/black/black/mode.pyr      s   r   c               @   sT   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdS )Feature   r   r   r   r   r   r   r   r   r                     2   3   N)r   r   r   	F_STRINGSNUMERIC_UNDERSCORESTRAILING_COMMA_IN_CALLTRAILING_COMMA_IN_DEFASYNC_IDENTIFIERSASYNC_KEYWORDSASSIGNMENT_EXPRESSIONSPOS_ONLY_ARGUMENTSRELAXED_DECORATORSPATTERN_MATCHINGUNPACKING_ON_FLOWANN_ASSIGN_EXTENDED_RHSEXCEPT_STARVARIADIC_GENERICSDEBUG_F_STRINGSPARENTHESIZED_CONTEXT_MANAGERSZFORCE_OPTIONAL_PARENTHESESFUTURE_ANNOTATIONSr#   r#   r#   r$   r%   #   s$   r%   annotationsFUTURE_FLAG_TO_FEATUREVERSION_TO_FEATURES)target_versionsfeaturereturnc                s   t  fdd| D S )Nc             3   s   | ]} t | kV  qd S )N)rB   ).0version)rD   r#   r$   	<genexpr>   s    z#supports_feature.<locals>.<genexpr>)all)rC   rD   r#   )rD   r$   supports_feature   s    rJ   c               @   sR   e Zd ZdZe Ze Ze Ze Ze Z	e Z
e Ze Ze Ze Ze ZdS )Previewz"Individual preview style features.N)r   r   r   __doc__r   Zadd_trailing_comma_consistentlyZ"blank_line_after_nested_stub_classZhex_codes_in_unicode_sequencesZ"improved_async_statements_handlingZmultiline_string_handlingZ/prefer_splitting_right_hand_side_of_assignmentsstring_processingZ$parenthesize_conditional_expressionsZ&skip_magic_trailing_comma_in_subscriptZwrap_long_dict_values_in_parensZ(wrap_multiple_context_managers_in_parensr#   r#   r#   r$   rK      s   rK   c               @   s   e Zd ZdZdS )
DeprecatedzVisible deprecation warning.N)r   r   r   rL   r#   r#   r#   r$   rN      s   rN   c               @   s   e Zd ZU eedZee ed< e	Z
eed< dZeed< dZeed< dZeed< dZeed	< dZeed
< dZeed< eedZee ed< dZeed< ddddZeedddZedddZdS )Mode)default_factoryrC   line_lengthTstring_normalizationFis_pyiis_ipynbskip_source_first_linemagic_trailing_commaexperimental_string_processingpython_cell_magicspreviewN)rE   c             C   s   | j rtdt d S )Nzf`experimental string processing` has been included in `preview` and deprecated. Use `preview` instead.)rW   r
   rN   )selfr#   r#   r$   __post_init__   s    zMode.__post_init__)rD   rE   c             C   s   |t jkr| jp| jS | jS )z
        Provide `Preview.FEATURE in Mode` syntax that mirrors the ``preview`` flag.

        The argument is not checked and features are not differentiated.
        They only exist to make development easier by clarifying intent.
        )rK   rM   rY   rW   )rZ   rD   r#   r#   r$   __contains__   s    
zMode.__contains__c             C   s   | j r*ddd t| j tddD }nd}|t| jtt| jtt| jtt| j	tt| j
tt| jtt| jtt| jtdt| j  g
}d|S )N,c             s   s   | ]}t |jV  qd S )N)strvalue)rF   rG   r#   r#   r$   rH      s   z%Mode.get_cache_key.<locals>.<genexpr>r_   )key-.)rC   joinsortedr   r^   rQ   intrR   rS   rT   rU   rV   rW   rY   r   rX   encode	hexdigest)rZ   version_strpartsr#   r#   r$   get_cache_key   s     zMode.get_cache_key)r   r   r   r   setrC   r	   r   __annotations__r   rQ   re   rR   boolrS   rT   rU   rV   rW   rX   r^   rY   r[   rK   r\   rj   r#   r#   r#   r$   rO      s   

rO   );rL   sysZdataclassesr   r   enumr   r   hashlibr   operatorr   typingr   r	   warningsr
   version_infoZtyping_extensionsr   Zblack.constr   r   r%   r?   rA   rl   r   r3   r   r   r1   r   r/   r0   r2   r   r4   r   r=   r5   r6   r9   r:   r    r7   r>   r!   r8   r"   r;   r<   rB   rm   rJ   rK   UserWarningrN   rO   r#   r#   r#   r$   <module>   s   


