
    yIf"                    p   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
 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 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' G d d          Z( G d de(          Z)dS )    )annotationsN)Sequence)Path)ClassVar)config)clear_lru_caches)_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        C/var/www/piapp/venv/lib/python3.11/site-packages/pylint/lint/run.py
_query_cpur(   (   sO    &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
 	+OO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   N   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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boolr   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                   | j        rt-          |j                   t1          |||| j        | j                  }| j        rCt3          j        dt6          d	
           t9          |          }|rt          j        |           d S |r4t;          |j        j                  t;          |j        j                   k    r#t          d           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    ratD          2t          dt          j
                   |#                    dd           n(|j        j!        dk    rtI                      |j        _!        | j        r	 tK          | j        dd          5 }||j&        _'        |(                    |           |)                    | j                  }	d d d            n# 1 swxY w Y   nv# tT          $ r9}t          |t          j
                   t          j        d           Y d }~n8d }~ww xY w|(                    |           |)                    | j                  }	|j        j+        r!tY                       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)config_fileverbose_modezFNOTE: The 'pylint-config' command is experimental and usage can change   )
stacklevelzNo files to lint: exiting.zJobs number (z&) should be greater than or equal to 0r   z@concurrent.futures module is missing, fallback to single processjobswr   r   )verbose)3printr   r2   rA   _rcfile_output_pluginsrN   r   r   stderrnextr   find_default_config_filesstrLinterClassr   rF   linterload_default_pluginsload_plugin_modulesr<   r
   _arg_parserr   warningswarnUserWarningr	   r/   disable
msgs_store_messages_definitionsrL   r   
set_optionr6   r   r?   outcheckgenerate_reportsOSErrorclear_cache_post_runr   r   clear_cache	exit_zeroany_fail_on_issues
msg_status
fail_under)
selfr=   r?   rA   exdefault_filerX   codeoutputscore_values
             r'   __init__zRun.__init__v   s'    $,HQKKK#'#'#%"	&tT22DD) 	 	 	"3:&&&&HRLLLLLLLL	
 < @ B BDIIL 1"<00#//d##,\  0  
  
 	
f 	##%%%""4=111 ! 	B-f.@AAA%D(4<
 
 

 ! 		MX   
 2&99D F  	s6=011S36
 6
 
 
 .///HRLLL=!!Z 2ZZZZ    HRLLL=!!V]%71%<%<"*V    !!&!,,,,#q((%/\\"< 	H$,g>>> P&*0FO'LL&&&"("9"9$,"9"O"OKP P P P P P P P P P P P P P P    bsz**** LL 11$,1GGK=- 	"!!! 	1}& 1**,, 1 /4155555(&-":::HQKKKKK HT[38q99999/00000	1 	1sT   
A 
B%/BB5M! =M	M! MM! MM! !
N$+/NN$)NT)r=   r>   r?   r@   rA   rB   r   rC   )
__name__
__module____qualname____doc__r   rW   rF   r<   __annotations__rs    r7   r'   r9   r9   d   si         KKKM ).---- )-	r1 r1 r1 r1 r1 r1 r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)rt   ru   rv   rw   r<   rx   ry   r7   r'   r{   r{      s.         <<(,,,,, r7   r{   )r   r   )r   r   )*
__future__r   r.   r2   r\   collections.abcr   pathlibr   typingr   pylintr   pylint.checkers.utilsr   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   r9   r{   ry   r7   r'   <module>r      sV  
 # " " " " " 				 



  $ $ $ $ $ $                   2 2 2 2 2 2        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   # # # #L   ,D1 D1 D1 D1 D1 D1 D1 D1N    s     s$   &
A1 1A;:A;?B BB