bgdZddlmZddlZddlZddlZddlZddlmZddl m Z ddl m Z ej dkrddlZnddlZe rddlmZGd d ZdS) z Configuration file parser class.) annotationsN)Path) TYPE_CHECKING)_parse_rich_type_value) )PyLintercJeZdZdZddZdd Zedd ZddZddZ dS)_ConfigurationFileParserz6Class to parse various formats of configuration files.verboseboollinterr returnNonec"||_||_dS)N) verbose_moder)selfr rs q/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pylint/config/config_file_parser.py__init__z!_ConfigurationFileParser.__init__s# file_pathr tuple[dict[str, str], list[str]]ctjd}t|d5}||dddn #1swxYwYi}g}|D]}||rI|ds4|dkrtj dtn`|| D]\}}|||<|d ||gz }||fS) z4Parse and handle errors of a ini configuration file.)#;)inline_comment_prefixes utf_8_sig)encodingNpylintmasterzThe use of 'MASTER' or 'master' as configuration section for pylint has been deprecated, as it's bad practice to not start sections titles with the tool name. Please use 'pylint.main' instead.--) configparser ConfigParseropen read_filesections_ini_file_with_sections startswithlowerwarningswarn UserWarningitems) rrparserfpconfig_contentoptionssectionoptvalues r_parse_ini_filez(_ConfigurationFileParser._parse_ini_file"s{*:NNN)k 2 2 2 !b   R  ! ! ! ! ! ! ! ! ! ! ! ! ! ! !*,(( / /G++I66 w?Q?Q@@ ==??h..MP$ $Wo3355 / / U&+s#JJJ.. /w&&sA  A A c2d|jvrdSd|jvrdSdS)z&Return whether the file uses sections.z setup.cfgTztox.iniF)parts)rs rr'z0_ConfigurationFileParser._ini_file_with_sections?s- )/ ) )4   ' '4urcx t|d5}tj|}dddn #1swxYwYnJ#tj$r8}|jddt |igfcYd}~Sd}~wwxYw |dd}n#t$rigfcYSwxYwi}g}|D]q\}} t| tr9| D]#\} } t| } | || <|d | | gz }$St| } | ||<|d || gz }r||fS) z5Parse and handle errors of a toml configuration file.rb)modeNconfig-parse-errorrlineargstoolrr!) r$tomllibloadTOMLDecodeErrorr add_messagestrKeyErrorr- isinstancedictr) rrr/contentesections_valuesr0r1r3valuesconfigr4s r_parse_toml_filez)_ConfigurationFileParser._parse_toml_fileHs id+++ +r!,r** + + + + + + + + + + + + + + +&    K # #$8qs1vv # N N Nr6MMMMMM  %foh7OO   r6MMM *,*0022 0 0KC&$'' 0%+\\^^66MFE2599E-2N6* V u55GG6 077&,s#JJJ//w&&sJA4 A8A8AB-B<BB BB+*B+ Path | Nonec~|&|jrtdtjigfSt t j|}| std|d|jrtd|tj |j dkr| |S| |S#tjt jf$r8}|jdd t)| igfcYd}~Sd}~wwxYw) z-Parse a config file and return str-str pairs.Nz1No config file found, using default configuration)filezThe config file z doesn't exist!zUsing config file z.tomlr;rr<)rprintsysstderrrospath expandvars expanduserexistsOSErrorsuffixrMr5r"Errorr@rBrrCrD)rrrIs rparse_config_filez*_ConfigurationFileParser.parse_config_fileds\    Gcjr6M++I6677BBDD !! IGYGGGHH H   E 2y22 D D D D 7**,,Y777'' 22 2"G$;<    K # #$8qs1vv # N N Nr6MMMMMM s$4C)C))D<-D71D<7D<N)r r rr rr)rrrr)rrrr )rrNrr) __name__ __module__ __qualname____doc__rr5 staticmethodr'rMr\rrr r s@@'''':\''''8rr )r` __future__rr"rTrRr*pathlibrtypingrpylint.config.utilsr version_infor@tomli pylint.lintr r rbrrrjs '&""""""  666666wNNNN%$$$$$$aaaaaaaaaar