
    ~_                     h   d Z ddlmZ ddl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y")#z;All isort specific exception classes should be defined here    )Path)AnyDictUnion   )profilesc                       e Zd ZdZy)
ISortErrorzRBase isort exception object from which all isort sourced exceptions should inheritN)__name__
__module____qualname____doc__     2/usr/lib/python3/dist-packages/isort/exceptions.pyr
   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   )selfr   	__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                 2    t         |   |       || _        y Nr#   )r   r*   r    r   s      r   r   zFileSkipped.__init__1   s    !"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 )FileSkipCommentzFRaised when an entire file is skipped due to a isort skip file commentr    c                 .    t         |   | d|       y )Nz/ contains an file skip comment and was skipped.r    r   r   r$   s     r   r   zFileSkipComment.__init__9   s#    kHIU^ 	 	
r   r   r   s   @r   r.   r.   6   s    P
# 
 
r   r.   c                   (     e Zd ZdZdef fdZ xZS )FileSkipSettingzDRaised when an entire file is skipped due to provided isort settingsr    c                 .    t         |   | d|       y )NzV was skipped as it's listed in 'skip' setting or matches a glob in 'skip_glob' settingr0   r1   r$   s     r   r   zFileSkipSetting.__init__B   s'    k 8 8 	 	
r   r   r   s   @r   r3   r3   ?   s    N
# 
 
r   r3   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   r7   )r   r7   r   s     r   r   zProfileDoesNotExist.__init__M   s;    #G9 -##&88H#5"6a9	
 r   r   r   s   @r   r6   r6   J   s    E  r   r6   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   r=   )r   r=   r   s     r   r   z%FormattingPluginDoesNotExist.__init__X   s"    :9+EVWX"r   r   r   s   @r   r<   r<   U   s    O## # #r   r<   c                   ,     e Zd ZdZdede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   rA   rB   )r   rA   rB   r   s      r   r   zLiteralParsingFailure.__init__b   s;    6tf =<<J;K1N	

 	,r   )r   r   r   r   r   	Exceptionr   r   r   s   @r   r@   r@   ]   s     -S -) - -r   r@   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   rG   rH   )r   rG   rH   r   s      r   r   z LiteralSortTypeMismatch.__init__q   s:    7 G!!%a)	
 	*r   )r   r   r   r   typer   r   r   s   @r   rF   rF   l   s     +T +$ + +r   rF   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.
    rA   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   rA   )r   rA   r   s     r   r   z"AssignmentsFormatMismatch.__init__   s+    Zf 	
 	r   r   r   s   @r   rL   rL   z   s    
S 
 
r   rL   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   )rP   rQ   rR   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r,   )rU   ).0rP   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/.
)r:   itemsr   r   rV   )r   rV   errorsr   s   `  r   r   zUnsupportedSettings.__init__   sT     
DXD^D^D`
 
 	Fh KK	
 %9!r   )r   r   r   r   staticmethodr   r   rU   r   r   r   r   s   @r   rO   rO      s[     =S = =c =c = =9T#tCH~2E-F 9 9r   rO   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   rb   )r   rb   r   s     r   r   zUnsupportedEncoding.__init__   s!     	>xjIJ r   )	r   r   r   r   r   r   r   r   r   r   s   @r   ra   ra      s!    T!T	"! !r   ra   N)r   pathlibr   typingr   r   r   r   rD   r
   r   r   r&   r)   r.   r3   r6   r<   r@   rF   rL   rO   ra   r   r   r   <module>rf      s    A  # # ] ]	+* 	+#: ##Z ##* #
k 

k 
* #: #-J -+j +
 $9* 9.!* !r   