
    c"                    |   d dl mZ d dlZd dlZd dlZd dlmZ d dlmZ d dl	m
Z
mZ d dlmZ d dlmZ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 	 d dl Z d dl m!Z! n# e"$ r dZ Y nw xY w	 d dl#m$Z$ n# e"$ r dZ$Y nw xY wddZ%ddZ& e'            Z( G d d          Z) G d de)          Z*dS )    )annotationsN)Sequence)Path)AnyClassVar)config)_handle_pylint_config_commands!_register_generate_config_options)_config_initialization)ArgumentPreprocessingError)_preprocess_options)full_version)_make_run_options)MANAGERPyLinter)BaseReporter)synchronize)ProcessPoolExecutorreturn
int | Nonec                 h   d\  } }t          d                                          r\t          dd          5 }t          |                                                                          } ddd           n# 1 swxY w Y   | r| dk    rt          d                                          rot          dd          5 }t          |                                                                          }ddd           n# 1 swxY w Y   t          | |z            }nt          d                                          rnt          dd          5 }t          |                                                                          }ddd           n# 1 swxY w Y   t          |d	z            }|d
k    rd}|S )zTry to determine number of CPUs allotted in a docker container.

    This is based on discussion and copied from suggestions in
    https://bugs.python.org/issue36054.
    )NNz#/sys/fs/cgroup/cpu/cpu.cfs_quota_usutf-8encodingNz$/sys/fs/cgroup/cpu/cpu.cfs_period_usz/sys/fs/cgroup/cpu/cpu.sharesi   r      )r   is_fileopenintreadrstrip)	cpu_quota	avail_cpufile
cpu_period
cpu_sharess        /lib/python3.11/site-packages/pylint/lint/run.py
_query_cpur(   '   sW    &Iy122::<< 27'JJJ 	2dDIIKK..0011I	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2
 	+O+ 788@@BB+
 87KKK 	3tTYY[[//1122J	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	J.//			-	.	.	6	6	8	8 +1GDDD 	3TYY[[//1122J	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 	3 
T)**	
 A~ 	s5   4A88A<?A<=4C==DD4FFFr   c                 &   t                      } d}t          t          dd          }|rt           |d                    }nt          rt	          j                    }nd}t          j        dk    rt          |d          }| t          | |          S |S )zWUse sched_affinity if available for virtualized or containerized
    environments.
    Nsched_getaffinityr   r   win328   )	r(   getattroslenmultiprocessing	cpu_countsysplatformmin)	cpu_sharer1   r*   s      r'   
_cpu_countr6   L   s     II$7>> ))!,,--			 #-//			
|w '	2&&	 )9i(((    c                  <    e Zd ZU dZeZdZdZded<   	 dde	fddZ
dS )RunzAHelper class to use as main for pylint with 'run(*sys.argv[1:])'.))CommandszROptions which are actually commands. Options in this group are mutually exclusive.FClassVar[bool]_is_pylint_configNTargsSequence[str]reporterBaseReporter | Noneexitbooldo_exitr   r   Nonec                	   d|v r(t          t                     t          j        d           d | _        d | _        g | _        d| _        	 t          | |          }nF# t          $ r9}t          |t          j
                   t          j        d           Y d }~nd }~ww xY w| j        7t          t          j                    d           }|rt          |          | _        |                     t!          |           | j        | j                  x| _        }|                                 |                    | j                   |                    d           |                    d           | j        rt1          |j                   t5          |||| j        | j        	          }| j        rAt7          j        d
t:                     t=          |          }|rt          j        |           d S |s5t          |                                           t          j        d           |j        j         dk     r=t          d|j        j          dt          j
                   t          j        d           |j        j         dk    s|j        j         dk    ratB          2t          dt          j
                   |"                    dd           n(|j        j         dk    rtG                      |j        _         | j        r	 tI          | j        dd          5 }	|	|j%        _&        |'                    |           |(                                }
d d d            n# 1 swxY w Y   no# tR          $ r9}t          |t          j
                   t          j        d           Y d }~n1d }~ww xY w|'                    |           |(                                }
|tT          urt7          j        dtV                     |}|j        j,        rt[          j.                     |r|j        j/        rt          j        d           d S |0                                r"t          j        | j        j1        pd           d S |
H|
|j        j2        k    rt          j        d           d S t          j        | j        j1        pd           d S t          j        | j        j1                   d S d S )Nz	--versionr   F)r$       )option_groupspylintrcIzc-extension-no-member)config_fileverbose_modezFNOTE: The 'pylint-config' command is experimental and usage can changezJobs number (z&) should be greater than or equal to 0r   z@concurrent.futures module is missing, fallback to single processjobswr   r   zHdo_exit is deprecated and it is going to be removed in a future version.)3printr   r2   rA   _rcfile_output_pluginsverboser   r   stderrnextr   find_default_config_filesstrLinterClassr   rG   linterload_default_pluginsload_plugin_modulesdisableenabler<   r
   _arg_parserr   warningswarnUserWarningr	   helprL   r   
set_optionr6   r   r?   outcheckgenerate_reportsOSErrorUNUSED_PARAM_SENTINELDeprecationWarningclear_cache_post_runr   clear_cache	exit_zeroany_fail_on_issues
msg_status
fail_under)selfr=   r?   rA   rC   exdefault_filerX   codeoutputscore_values              r'   __init__zRun.__init__w   s1    $ 	,HQKKK#'#'#%"	&tT22DD) 	 	 	"3:&&&&HRLLLLLLLL	
 < 	1 @ B BDIIL 1"<00#//d##,\  0  
  
 	
f 	##%%%""4=111s-... ! 	B-f.@AAA%D(4<
 
 

 ! 	MX   2&99D F  	&++--   HRLLL=! 	Z 2ZZZZ    HRLLL=! 	2V]%71%< 	2" 2V    !!&!,,,,#q( 2%/\\"< 	4$,g>>> <&*0FO'LL&&&"("9"9";";K< < < < < < < < < < < < < < <    bsz**** LL 1133K// 	MZ"   D=- 	"!!! 	1}& 1**,, 1 /4155555 1&-":: :HQKKKKK HT[38q99999/00000	1 	1sT   
A 
B%/BB;M  6MM  MM  MM   
N#*/NN#)
r=   r>   r?   r@   rA   rB   rC   r   r   rD   )__name__
__module____qualname____doc__r   rW   rG   r<   __annotations__rg   ru    r7   r'   r9   r9   e   sl         KKKM ).---- )-,z1 z1 z1 z1 z1 z1 z1r7   r9   c                  "    e Zd ZU dZdZded<   dS )_PylintConfigRunz2A private wrapper for the 'pylint-config' command.Tr;   r<   N)rv   rw   rx   ry   r<   rz   r{   r7   r'   r}   r}      s.         <<(,,,,, r7   r}   )r   r   )r   r   )+
__future__r   r.   r2   r^   collections.abcr   pathlibr   typingr   r   pylintr   pylint.config._pylint_configr	   r
   #pylint.config.config_initializationr   pylint.config.exceptionsr   pylint.config.utilsr   pylint.constantsr   pylint.lint.base_optionsr   pylint.lint.pylinterr   r   pylint.reporters.base_reporterr   r0   r   ImportErrorconcurrent.futuresr   r(   r6   objectrg   r9   r}   r{   r7   r'   <module>r      sX  
 # " " " " " 				 



  $ $ $ $ $ $                                    G F F F F F ? ? ? ? ? ? 3 3 3 3 3 3 ) ) ) ) ) ) 6 6 6 6 6 6 2 2 2 2 2 2 2 2 7 7 7 7 7 7+++++++   OOO6666666   " " " "J   ,  L1 L1 L1 L1 L1 L1 L1 L1^    s     s$   "
A- -A76A7;B BB