
    yIf                     
   d Z ddlmZ ddlmZ ddlmZmZmZm	Z	m
Z
 ddlmZ  G d de          Z G d	 d
e          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d d e          Z G d! d"e          Z G d# d$e          Z G d% d&e          Zd'S )(z;All isort specific exception classes should be defined here    )partial)Path)AnyDictListTypeUnion   )profilesc                       e Zd ZdZd ZdS )
ISortErrorzRBase isort exception object from which all isort sourced exceptions should inheritc                 D    t          t          |           fi | j        dfS )N )r   type__dict__)selfs    D/var/www/piapp/venv/lib/python3.11/site-packages/isort/exceptions.py
__reduce__zISortError.__reduce__   s%    T

44dm44b99    N)__name__
__module____qualname____doc__r   r   r   r   r   r   	   s)        \\: : : : :r   r   c                   (     e Zd ZdZdef fdZ xZS )InvalidSettingsPathzQRaised when a settings path is provided that is neither a valid file or directorysettings_pathc                 `    t                                          d| d           || _        d S )Nz)isort was told to use the settings_path: zr as the base directory or file that represents the starting point of config file discovery, but it does not exist.)super__init__r   )r   r   	__class__s     r   r   zInvalidSettingsPath.__init__   sE       	
 	
 	

 +r   r   r   r   r   strr   __classcell__r    s   @r   r   r      sJ        [[+c + + + + + + + + + +r   r   c                   (     e Zd ZdZdef fdZ xZS )ExistingSyntaxErrorszURaised when isort is told to sort imports within code that has existing syntax errors	file_pathc                 `    t                                          d| d           || _        d S )NzHisort was told to sort imports within code that contains syntax errors: .r   r   r'   r   r'   r    s     r   r   zExistingSyntaxErrors.__init__   C      	
 	
 	
 #r   r!   r$   s   @r   r&   r&      sJ        __## # # # # # # # # # #r   r&   c                   (     e Zd ZdZdef fdZ xZS )IntroducedSyntaxErrorszQRaised when isort has introduced a syntax error in the process of sorting importsr'   c                 `    t                                          d| d           || _        d S )NzTisort introduced syntax errors when attempting to sort the imports contained within r)   r*   r+   s     r   r   zIntroducedSyntaxErrors.__init__*   r,   r   r!   r$   s   @r   r.   r.   '   sJ        [[## # # # # # # # # # #r   r.   c                   ,     e Zd ZdZdedef fdZ xZS )FileSkippedz6Should be raised when a file is skipped for any reasonmessager'   c                 f    t                                          |           || _        || _        d S N)r   r   r2   r'   )r   r2   r'   r    s      r   r   zFileSkipped.__init__5   s-    !!!"r   r!   r$   s   @r   r1   r1   2   sQ        @@# # # # # # # # # # # #r   r1   c                   ,     e Zd ZdZdedef fdZ xZS )FileSkipCommentzFRaised when an entire file is skipped due to a isort skip file commentr'   kwargsc                 T    t                                          | d|           d S )Nz. contains a file skip comment and was skipped.r'   r   r   r   r'   r7   r    s      r   r   zFileSkipComment.__init__>   s=    HHHT] 	 	
 	
 	
 	
 	
r   r!   r$   s   @r   r6   r6   ;   sQ        PP
# 
 
 
 
 
 
 
 
 
 
 
r   r6   c                   ,     e Zd ZdZdedef fdZ xZS )FileSkipSettingzDRaised when an entire file is skipped due to provided isort settingsr'   r7   c                 T    t                                          | d|           d S )NzV was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' settingr9   r:   r;   s      r   r   zFileSkipSetting.__init__G   sC     8 8 8 	 	
 	
 	
 	
 	
r   r!   r$   s   @r   r=   r=   D   sQ        NN
# 
 
 
 
 
 
 
 
 
 
 
r   r=   c                   (     e Zd ZdZdef fdZ xZS )ProfileDoesNotExistz;Raised when a profile is set by the user that doesn't existprofilec                     t                                          d| dd                    t                     d           || _        d S )NzSpecified profile of z% does not exist. Available profiles: ,r)   )r   r   joinr   rA   )r   rA   r    s     r   r   zProfileDoesNotExist.__init__R   s[    9G 9 9#&88H#5#59 9 9	
 	
 	
 r   r!   r$   s   @r   r@   r@   O   sJ        EE          r   r@   c                   8     e Zd ZdZdedee         f fdZ xZS )SortingFunctionDoesNotExistz:Raised when the specified sorting function isn't available
sort_orderavailable_sort_ordersc                     t                                          d| dd                    |           d           || _        || _        d S )NzSpecified sort_order of z( does not exist. Available sort_orders: rC   r)   )r   r   rD   rG   rH   )r   rG   rH   r    s      r   r   z$SortingFunctionDoesNotExist.__init__]   sl    Iz I I&)hh/D&E&EI I I	
 	
 	
 %%:"""r   )r   r   r   r   r"   r   r   r#   r$   s   @r   rF   rF   Z   sU        DD;3 ;tCy ; ; ; ; ; ; ; ; ; ;r   rF   c                   (     e Zd ZdZdef fdZ xZS )FormattingPluginDoesNotExistzERaised when a formatting plugin is set by the user that doesn't exist	formatterc                 `    t                                          d| d           || _        d S )NzSpecified formatting plugin of z does not exist. )r   r   rL   )r   rL   r    s     r   r   z%FormattingPluginDoesNotExist.__init__i   s2    W9WWWXXX"r   r!   r$   s   @r   rK   rK   f   sJ        OO## # # # # # # # # # #r   rK   c                   H     e Zd ZdZdedeeee         f         f fdZ xZ	S )LiteralParsingFailurezwRaised when one of isorts literal sorting comments is used but isort can't parse the
    the given data structure.
    codeoriginal_errorc                 t    t                                          d| d| d           || _        || _        d S )Nz(isort failed to parse the given literal z. It's important to note that isort literal sorting only supports simple literals parsable by ast.literal_eval which gave the exception of r)   )r   r   rP   rQ   )r   rP   rQ   r    s      r   r   zLiteralParsingFailure.__init__s   s_    Nt N N<JN N N	
 	
 	

 	,r   )
r   r   r   r   r"   r	   	Exceptionr   r   r#   r$   s   @r   rO   rO   n   sc         -S -%	4	?8R2S - - - - - - - - - -r   rO   c                   ,     e Zd ZdZdedef fdZ xZS )LiteralSortTypeMismatchzRaised when an isort literal sorting comment is used, with a type that doesn't match the
    supplied data structure's type.
    kindexpected_kindc                 t    t                                          d| d| d           || _        || _        d S )Nz)isort was told to sort a literal of type z! but was given a literal of type r)   )r   r   rV   rW   )r   rV   rW   r    s      r   r   z LiteralSortTypeMismatch.__init__   sY    ) ) )!%) ) )	
 	
 	
 	*r   )r   r   r   r   r   r   r#   r$   s   @r   rU   rU   }   sU         +T +$ + + + + + + + + + +r   rU   c                   (     e Zd ZdZdef fdZ xZS )AssignmentsFormatMismatchzRaised when isort is told to sort assignments but the format of the assignment section
    doesn't match isort's expectation.
    rP   c                 `    t                                          d| d           || _        d S )NzJisort was told to sort a section of assignments, however the given code:

z

Does not match isort's strict single line formatting requirement for assignment sorting:

{variable_name} = {value}
{variable_name2} = {value2}
...

)r   r   rP   )r   rP   r    s     r   r   z"AssignmentsFormatMismatch.__init__   sC      	
 	
 	
 			r   r!   r$   s   @r   rZ   rZ      sN         
S 
 
 
 
 
 
 
 
 
 
r   rZ   c            	       p     e Zd ZdZededededefd            Zdeeeeef         f         f fdZ	 xZ
S )	UnsupportedSettingszrRaised when settings are passed into isort (either from config, CLI, or runtime)
    that it doesn't support.
    namevaluesourcereturnc                     d|  d| d| dS )Nz	- z = z  (source: 'z')r   )r^   r_   r`   s      r   _format_optionz"UnsupportedSettings._format_option   s#    <d<<u<<&<<<<r   unsupported_settingsc                      d                      fd|                                D                       }t                                          d| d           | _        d S )N
c              3   :   K   | ]\  }} j         |fi |V  d S r4   )rc   ).0r^   optionr   s      r   	<genexpr>z/UnsupportedSettings.__init__.<locals>.<genexpr>   sN       
 
4@D&D////
 
 
 
 
 
r   z6isort was provided settings that it doesn't support:

z}

For a complete and up-to-date listing of supported settings see: https://pycqa.github.io/isort/docs/configuration/options.
)rD   itemsr   r   rd   )r   rd   errorsr    s   `  r   r   zUnsupportedSettings.__init__   s     
 
 
 
DXD^D^D`D`
 
 
 
 
 	JJ J J	
 	
 	
 %9!!!r   )r   r   r   r   staticmethodr"   r   rc   r   r   r#   r$   s   @r   r]   r]      s          =S = =c =c = = = \=9T#tCH~2E-F 9 9 9 9 9 9 9 9 9 9r   r]   c                   8     e Zd ZdZdeeef         f fdZ xZS )UnsupportedEncodingzJRaised when isort encounters an encoding error while trying to read a filefilenamec                 ^    t                                          d|            || _        d S )Nz#Unknown or unsupported encoding in )r   r   rp   )r   rp   r    s     r   r   zUnsupportedEncoding.__init__   s/    IxIIJJJ r   )	r   r   r   r   r	   r"   r   r   r#   r$   s   @r   ro   ro      sS        TT!sDy!1 ! ! ! ! ! ! ! ! ! !r   ro   c                   ,     e Zd ZdZdedef fdZ xZS )MissingSectionzQRaised when isort encounters an import that matches a section that is not definedimport_modulesectionc                 X    t                                          d| d| d           d S )NzFound z import while parsing, but z was not included in the `sections` setting of your config. Please add it before continuing
See https://pycqa.github.io/isort/#custom-sections-and-ordering for more info.r:   )r   rt   ru   r    s      r   r   zMissingSection.__init__   sK    ]  w   	
 	
 	
 	
 	
r   r!   r$   s   @r   rs   rs      sQ        [[
c 
C 
 
 
 
 
 
 
 
 
 
r   rs   N)r   	functoolsr   pathlibr   typingr   r   r   r   r	   r   rS   r   r   r&   r.   r1   r6   r=   r@   rF   rK   rO   rU   rZ   r]   ro   rs   r   r   r   <module>rz      s   A A             / / / / / / / / / / / / / /      : : : : : : : :	+ 	+ 	+ 	+ 	+* 	+ 	+ 	+# # # # #: # # ## # # # #Z # # ## # # # #* # # #
 
 
 
 
k 
 
 

 
 
 
 
k 
 
 
    *   	; 	; 	; 	; 	;* 	; 	; 	;# # # # #: # # #- - - - -J - - -+ + + + +j + + +    
   $9 9 9 9 9* 9 9 9.! ! ! ! !* ! ! !	
 	
 	
 	
 	
Z 	
 	
 	
 	
 	
r   