rddlZddlZddlZddlmZddlmZddlmZddl m Z ddl m Z ddl mZddlmZdd lmZmZdd lmZdd lmZdd lmZejd ZdededefdZGddeZdS)N) defaultdict)Path)List) find_pylintrc)UnknownMessageError) _cpu_count) FileFinderLocationMessage)ToolBase) Collector)ProspectorLinterz0^Unused import(\(s\))? (.*) from wildcard importsubpathpathreturnc|j|kSN)parent)rrs r/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/prospector/tools/pylint/__init__.py _is_in_dirrs >T !!ceZdZdZdefdZdZdZdefdZ de e fd Z ded e e fd Z d e e defd ZdZdZd e efdZdS) PylintToolc>d|_dx|_|_g|_dSr)_args _collector_linter_orig_sys_path)selfs r__init__zPylintTool.__init__s% )--$, rlinterc g}d|jvr|dgd|jvr|dgd|jvr|dgtj|j|jj}|jj dgD]U} ||g#t$r/| | |d|YRwxYw| d D](} ||#t$rY%wxYw|d }|D]O}t%|d s|jD]4} | d |vr(|| d || d 5P|d |d |d|d|j} |D]A}t%|d s|jD]&} | "| d dkr|d| 'B|S)Ndjango pylint_djangocelery pylint_celeryflask pylint_flaskz load-pluginsCould not load plugin pylintoptionsrzlocally-disabledz file-ignoredzsuppressed-messagezdeprecated-pragmazmax-line-length) librariesload_plugin_modulesosrjoinworkdirprofilenamer+get ImportErrorappend_error_messageget_disabled_messagesdisabler tool_options get_checkershasattrr, set_optionenablemax_line_length) r prospector_configr"errors profile_pathpluginmsg_idr,checkeroptionr?s r_prospector_configurez PylintTool._prospector_configure#s (2 2 2  & &'8 9 9 9 (2 2 2  & &'8 9 9 9 '1 1 1  & &'7 8 8 8w||$5$=?P?X?]^^ '/6::>2NN d dF d**F84444 d d d d11,@aY_@a@abbccccc d(==hGG  F v&&&&&     $00::**,, F FG7I.. !/ F F!9''&&vay'&)2DEEE F )*** n%%% *+++*++++;**,, O OG7I.. !/ O O".ay$555**+>! dgfm^&L&L d -4 d dd..x8888"dddMM$"5"5h@aY_@a@a"b"bcccccd sA6B B found_filesc|}||}|d}|||t |}|||||\}}|dt|j|_ | |j |j j dkrt|j _ ||_||fS)Nr+ similaritiesr) make_syspath_get_pylint_check_pathsr:_set_path_finderr_get_pylint_configurationr9r msgs_storer set_reporterrPjobsrr) r r@rTextra_sys_path check_pathspylint_optionsr"config_messages configured_bys r configurezPylintTool.configureis$113322;?? *77AA nn===!+..)-)G)G !2N* * & ~&&&$F$566DO,,, =  " "!+FM  o--rr^ctj|_|ds%tjd|Dzt_dSdS)Nuse_pylint_default_path_findercPg|]#}t|$S)strabsolute.0rs r z/PylintTool._set_path_finder..s("S"S"SD3t}}#7#7"S"S"Sr)sysrrr4)r r^r`s rrYzPylintTool._set_path_findersQ!h!!"BCC Tx"S"SN"S"S"SSCHHH T Trrczt}|j}|j}|d|D].}|D]}t ||rn||/t |D]9\}}|d|D]}t ||rn||:t|S)Nc:tt|Sr)lenrh)ps rz4PylintTool._get_pylint_check_paths..sCAKKr)key)setpython_modulespython_packagessortradd enumeratesorted) r rTr_modulespackagesmodulepackageidxprev_pkgs rrXz"PylintTool._get_pylint_check_pathssee ,. // 000 ( (F# ( (fg..E'''&h// ) )LC$TcTN ) )gx00E (((k"""rr_c$|d|D|_||||}d}|dr|d}|d}|p|p t}|MdD]J} tj |j | } tj | r| }nK||}|| ||z }||fS)Nc34K|]}t|VdSr)rhrjs r z7PylintTool._get_pylint_configuration..s(;^;^$CII;^;^;^;^;^;^rr+ config_file)z .pylintrcrQzpyproject.tomlz setup.cfg)load_command_line_configurationrload_default_pluginsrGuse_external_configr4external_config_locationrr/rr0r1existsrS) r r_r"r@r`rarbrQexternal_configpossible pylintrc_paths rrZz$PylintTool._get_pylint_configurations-;;;^;^R];^;^;^^^ ##%%%445FOO  0 0 : : N%))-88H/HHRROE?EmooH XH$&GLL1B1JH$U$UMw~~m44#0# ( 4#;#;Hf#M#MM --rctt}g}|D]C}|jdkr!||j|.||D|D]\}}g}|D]G}|t |j dHdd |z} tdd|| } || |S)z For the "unused import from wildcard import" messages, we want to combine all warnings about the same line into a single message. zunused-wildcard-importz'Unused imports from wildcard import: %sz, r+) rlistcoderLr6items_UNUSED_WILDCARD_IMPORT_REmatchrKgroupr0r ) r messagesby_locoutrKrL message_listnamesmsgmsgtxtcombined_messages r_combine_w0614zPylintTool._combine_w0614s T"" $ $G|777w'(//8888 7####&,llnn ) ) "HlE# U U 7==ckJJPPQRSSTTTT>5AQAQQF&x1I8U[\\  JJ' ( ( ( ( rcJ||}t|S)aR Combine repeated messages. Some error messages are repeated, causing many errors where only one is strictly necessary. For example, having a wildcard import will result in one 'Unused Import' warning for every unused import. This method will combine these into a single warning. )rrz)r rcombineds rcombinezPylintTool.combines%&&x00hrc|j|j|jt_|j}||Sr) rcheckrrrmrr get_messagesr)r rTrs rrunzPylintTool.runsI 4:&&&&?//11||H%%%rN)__name__ __module__ __qualname__r!rrGr7rSr rcrrrYrXrZrrr rrgrrrrs+ !!! 5?O5555nJJJ   . ....2TtDzTTTT #:#$t*####>.:./?....<4    &$w-&&&&&&rr)r/rerm collectionsrpathlibrtypingr pylint.configrpylint.exceptionsrpylint.lint.runrprospector.finderr prospector.messager r prospector.tools.baser !prospector.tools.pylint.collectorrprospector.tools.pylint.linterrcompilerboolrrrgrrrsf ######''''''111111&&&&&&((((((00000000******777777;;;;;;'RZ([\\""D"T""""Y&Y&Y&Y&Y&Y&Y&Y&Y&Y&r