
    \j                        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y')(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y)
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    :/root/env/lib/python3.12/site-packages/isort/exceptions.py
__reduce__zISortError.__reduce__   s    T
4dmm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       || _        y )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__   s,    7 G 	

 +r   r   r   r   r   strr   __classcell__r    s   @r   r   r      s    [+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       || _        y )NzHisort was told to sort imports within code that contains syntax errors: .r   r   r'   r   r'   r    s     r   r   zExistingSyntaxErrors.__init__   s(    Vk	
 #r   r!   r$   s   @r   r&   r&      s    _## # #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       || _        y )NzTisort introduced syntax errors when attempting to sort the imports contained within r)   r*   r+   s     r   r   zIntroducedSyntaxErrors.__init__*   s(    bk	
 #r   r!   r$   s   @r   r-   r-   '   s    [## # #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                 @    t         |   |       || _        || _        y N)r   r   r1   r'   )r   r1   r'   r    s      r   r   zFileSkipped.__init__5   s    !"r   r!   r$   s   @r   r0   r0   2   s    @# # # #r   r0   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         |   | d|       y )Nz. contains a file skip comment and was skipped.r'   r   r   r   r'   r6   r    s      r   r   zFileSkipComment.__init__>   s#    kGHT] 	 	
r   r!   r$   s   @r   r5   r5   ;   s    P
# 
 
 
r   r5   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'   r6   c                 .    t         |   | d|       y )NzV was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' settingr8   r9   r:   s      r   r   zFileSkipSetting.__init__G   s'    k 8 8 	 	
r   r!   r$   s   @r   r<   r<   D   s    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                 f    t         |   d| ddj                  t               d       || _        y )NzSpecified profile of z% does not exist. Available profiles: ,r)   )r   r   joinr   r@   )r   r@   r    s     r   r   zProfileDoesNotExist.__init__R   s;    #G9 -##&88H#5"6a9	
 r   r!   r$   s   @r   r?   r?   O   s    E  r   r?   c                   2     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                 l    t         |   d| ddj                  |       d       || _        || _        y )NzSpecified sort_order of z( does not exist. Available sort_orders: rB   r)   )r   r   rC   rF   rG   )r   rF   rG   r    s      r   r   z$SortingFunctionDoesNotExist.__init__]   sE    &zl 3&&)hh/D&E%FaI	
 %%:"r   )r   r   r   r   r"   r   r   r#   r$   s   @r   rE   rE   Z   s"    D;3 ;tCy ; ;r   rE   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       || _        y )NzSpecified formatting plugin of z does not exist. )r   r   rK   )r   rK   r    s     r   r   z%FormattingPluginDoesNotExist.__init__i   s"    :9+EVWX"r   r!   r$   s   @r   rJ   rJ   f   s    O## # #r   rJ   c                   <     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                 N    t         |   d| d| d       || _        || _        y )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   rO   rP   )r   rO   rP   r    s      r   r   zLiteralParsingFailure.__init__s   s;    6tf =<<J;K1N	

 	,r   )
r   r   r   r   r"   r	   	Exceptionr   r   r#   r$   s   @r   rN   rN   n   s.    -S -%	4	?8R2S - -r   rN   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                 N    t         |   d| d| d       || _        || _        y )Nz)isort was told to sort a literal of type z! but was given a literal of type r)   )r   r   rU   rV   )r   rU   rV   r    s      r   r   z LiteralSortTypeMismatch.__init__   s:    7 G!!%a)	
 	*r   )r   r   r   r   r   r   r#   r$   s   @r   rT   rT   }   s     +T +$ + +r   rT   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.
    rO   c                 :    t         |   d| d       || _        y )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   rO   )r   rO   r    s     r   r   z"AssignmentsFormatMismatch.__init__   s+    Zf 	
 	r   r!   r$   s   @r   rY   rY      s    
S 
 
r   rY   c            	       ^     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    dV3ug\&<<r   unsupported_settingsc                      dj                   fd|j                         D              }t           d| d       | _        y )N
c              3   J   K   | ]  \  }} j                   |fi |  y wr3   )rb   ).0r]   optionr   s      r   	<genexpr>z/UnsupportedSettings.__init__.<locals>.<genexpr>   s-      
4@D&D//
s    #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.
)rC   itemsr   r   rc   )r   rc   errorsr    s   `  r   r   zUnsupportedSettings.__init__   sT     
DXD^D^D`
 
 	Fh JJ	
 %9!r   )r   r   r   r   staticmethodr"   r   rb   r   r   r#   r$   s   @r   r\   r\      s[     =S = =c =c = =9T#tCH~2E-F 9 9r   r\   c                   2     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                 8    t         |   d|        || _        y )Nz#Unknown or unsupported encoding in )r   r   ro   )r   ro   r    s     r   r   zUnsupportedEncoding.__init__   s    >xjIJ r   )	r   r   r   r   r	   r"   r   r   r#   r$   s   @r   rn   rn      s     T!sDy!1 ! !r   rn   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                 2    t         |   d| d| d       y )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.r9   )r   rs   rt   r    s      r   r   zMissingSection.__init__   s)    ]O#>wi H 	
r   r!   r$   s   @r   rr   rr      s    [
c 
C 
 
r   rr   N)r   	functoolsr   pathlibr   typingr   r   r   r   r	   r   rR   r   r   r&   r-   r0   r5   r<   r?   rE   rJ   rN   rT   rY   r\   rn   rr   r   r   r   <module>ry      s    A   / / : :	+* 	+#: ##Z ##* #
k 

k 
* 	;* 	;#: #-J -+j +
 $9* 9.!* !	
Z 	
r   