
    e                        d dl mZ d dlZd dlZd dlmZ d dlmZ d dlmZ d dl	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
rd dlmZ 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 ddZddZy)    )annotationsNglob)chain)Path)TYPE_CHECKING)	reporters)_ConfigurationFileParser)ArgumentPreprocessingError_UnrecognizedOptionError)utils)PyLinterc                   |rt        |      nd}| j                  |rt        |      nd       t        ||       }	 |j	                  |      \  }}t        d      }dv r!t        t        j                  |d                d	|v r'| j                  t        j                  |d	                d}		 | j!                  |       |r| j)                  |       | j                  d       t        |d      }| j+                  |      }	 |j-                  d       g }|D ]N  }|j1                  d      r|j3                  |dd        )|j1                  d      s;|j3                  |dd        P |r0d
j%                  |      }	 | j4                  j7                  d|        |	2| j                  |rt        |      nd       | j;                  d|	d       | j<                  j>                  D ],  }d|vstA        jB                  d| d| dtD        ddd       . | jG                          | j                  d       | jI                          | jK                          | jM                          | j<                  i f| jN                  t        d      jQ                         <   tS        tU        jV                  d |D                    S # t
        $ r;}t        |t        j                         t        j                  d       Y d}~d}~ww xY w# t"        $ r&}
d
j%                  |
j&                        }	Y d}
~
md}
~
ww xY w# t.        $ r Y -w xY w# t8        $ r t        j                  d       Y w xY w)zoParse all available options, read config files and command line arguments and
    set options accordingly.
    N )	file_path)file    F)joinedz	init-hookzload-pluginsz, zCommand lineTz--   -   zUnrecognized option found: zunrecognized-optionr   )argsline.'zk' is not a proper value for the 'overgeneral-exceptions' option. Use fully qualified name (maybe 'builtins.zc' ?) instead. This will cease to be checked at runtime when the configuration upgrader is released.z*pylint: Command line or configuration filepylint)categoryfilenamelinenomodulez"Command line or configuration filec              3  @   K   | ]  }t        |d       xs |g  yw)T)	recursiveNr   ).0args     E/usr/lib/python3/dist-packages/pylint/config/config_initialization.py	<genexpr>z)_config_initialization.<locals>.<genexpr>   s+      
  %.#.
s   ),r   set_current_modulestrr
   parse_config_fileOSErrorprintsysstderrexit_order_all_firstexecr   _unquoteload_plugin_modules_splitstrip_parse_configuration_filer   joinoptionsset_reporter!_parse_command_line_configurationremove
ValueError
startswithappend_arg_parsererror
SystemExitadd_messageconfigovergeneral_exceptionswarningswarn_explicitUserWarning_emit_stashed_messagesload_plugin_configurationenable_fail_on_messages_parse_error_mode_directory_namespacesresolvelistr   from_iterable)linter	args_listreporterconfig_fileverbose_modeconfig_file_parserconfig_dataconfig_argsexunrecognized_options_messageexcparsed_args_listunrecognized_optionsoptmsgexc_names                   r%   _config_initializationr^      s^    (3${#K +c+.2F 2,G#5#G#G! $H $
 [ #;u=K k!U^^K456 $""5#4#4[5P#QR#' >((5 H% n- !48I??	J%
 ') 1>>$ ''AB0^^C  ''AB0	1
 ii,-	$$'B3%%HI $/!!k#k"2rJ!(D1 	 	

 MM88 h""H: ==EJ G(( %E	 !!# BC $$& ""$
 :@8KF  c!2!2!45  
 (
 	
	 	I  bszz"& $ >'+yy'=$>*    	HHRL	sS   J= 0L L6 >M =	L0K<<L	L3L..L36	MMM('M(c               $   g }d}t        |       D ]  \  }}|r7|j                  d      s|j                  d      r|j                  d      d   }n|dv r	| |dz      }nMdd |j                  d	      D        vrh|j                  d      d
   }|r||k7  rt        d      |}|j	                  |       |r|j	                  |dz           g }|D ]  }|j	                  | |           t        |       D ]  \  }}||v r|j	                  |        |S )a  Reorder config_args such that --enable=all or --disable=all comes first.

    Raise if both are given.

    If joined is True, expect args in the form '--enable=all,for-any-all'.
    If joined is False, expect args in the form '--enable', 'all,for-any-all'.
    r   z	--enable=z
--disable==r   >   --enable	--disableallc              3  <   K   | ]  }|j                           y w)N)strip)r#   r\   s     r%   r&   z#_order_all_first.<locals>.<genexpr>   s     AAs   ,r   z0--enable=all and --disable=all are incompatible.)	enumerater;   splitr   r<   )rU   r   indexes_to_prepend
all_actionir$   valuereturned_argss           r%   r/   r/      s@    JK( -3s~~k2cnn\6RIIcN1%E--A&EAC0@AAiinQ3*,,B  
!!!$%%a!e,)-, M -[^,- K( "3""S!"
     )NNF)rN   r   rO   	list[str]rP   z7reporters.BaseReporter | reporters.MultiReporter | NonerQ   zNone | str | PathrR   boolreturnro   )rU   ro   r   rp   rq   ro   )
__future__r   r,   rC   r   	itertoolsr   pathlibr   typingr   r   r	    pylint.config.config_file_parserr
   pylint.config.exceptionsr   r   pylint.utilsr   pylint.lintr   r^   r/    rn   r%   <module>r{      s   
 # 
        E $ IM%)CCC FC #	C
 C CL*rn   