选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
3 ÄvhVFã@sÈddlmZmZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z mZddlmZmZddlmZdd d „Zd d „Zddd„ZGdd„deƒZGdd„deƒZGdd„deƒZdS)é)Úabsolute_importÚunicode_literalsN)Ú defaultdict)Úpartial)Ú import_module)ÚDistutilsOptionErrorÚDistutilsFileError)Ú LegacyVersionÚparse)Ú string_typesFc Cs®ddlm}m}tjj|ƒ}tjj|ƒs4td|ƒ‚tjƒ}tj tjj |ƒƒzJ|ƒ}|rb|j ƒng}||krx|j |ƒ|j ||d�t||j|d�}Wdtj |ƒXt|ƒS)a,Read given configuration file and returns options from it as a dict. :param str|unicode filepath: Path to configuration file to get options from. :param bool find_others: Whether to search for other configuration files which could be on in various places. :param bool ignore_option_errors: Whether to silently ignore options, values of which could not be resolved (e.g. due to exceptions in directives such as file:, attr:, etc.). If False exceptions are propagated as expected. :rtype: dict r)Ú DistributionÚ _Distributionz%Configuration file %s does not exist.)Ú filenames)Úignore_option_errorsN)Zsetuptools.distr r ÚosÚpathÚabspathÚisfilerÚgetcwdÚchdirÚdirnameZfind_config_filesÚappendZparse_config_filesÚparse_configurationÚcommand_optionsÚconfiguration_to_dict) ÚfilepathZ find_othersrr r Zcurrent_directoryZdistrÚhandlers©rú/usr/lib/python3.6/config.pyÚread_configurations$      rcCslttƒ}x^|D]V}|j}|j}xD|jD]:}t|d|dƒ}|dkrNt||ƒ}n|ƒ}||||<q&WqW|S)z»Returns configuration data gathered by given handlers as a dict. :param list[ConfigHandler] handlers: Handlers list, usually from parse_configuration() :rtype: dict zget_%sN)rÚdictÚsection_prefixÚ target_objÚ set_optionsÚgetattr)rZ config_dictZhandlerZ obj_aliasr"ZoptionÚgetterÚvaluerrrr=s   rcCs6t|||ƒ}|jƒt|j|||jƒ}|jƒ||fS)aÒPerforms additional parsing of configuration options for a distribution. Returns a list of used option handlers. :param Distribution distribution: :param dict command_options: :param bool ignore_option_errors: Whether to silently ignore options, values of which could not be resolved (e.g. due to exceptions in directives such as file:, attr:, etc.). If False exceptions are propagated as expected. :rtype: list )ÚConfigOptionsHandlerr ÚConfigMetadataHandlerÚmetadataÚ package_dir)Z distributionrrÚoptionsÚmetarrrrZs rc@s¸eZdZdZdZiZd!dd„Zedd„ƒZdd „Z e d"d d „ƒZ e d d„ƒZ e dd„ƒZ e dd„ƒZedd„ƒZedd„ƒZe d#dd„ƒZe dd„ƒZe d$dd„ƒZdd„Zdd „ZdS)%Ú ConfigHandlerz1Handles metadata supplied in configuration files.NFcCsbi}|j}x:|jƒD].\}}|j|ƒs(q|j|dƒjdƒ}|||<qW||_||_||_g|_dS)NÚÚ.) r!ÚitemsÚ startswithÚreplaceÚstriprr"Úsectionsr#)Úselfr"r+rr4r!Ú section_nameÚsection_optionsrrrÚ__init__„s  zConfigHandler.__init__cCstd|jjƒ‚dS)z.Metadata item name to parser function mapping.z!%s must provide .parsers propertyN)ÚNotImplementedErrorÚ __class__Ú__name__)r5rrrÚparsers”szConfigHandler.parsersc CsÆtƒ}|j}|jj||ƒ}t|||ƒ}||kr6t|ƒ‚|r>dSd}|jj|ƒ}|r€y ||ƒ}Wn tk r~d}|jsz‚YnX|rˆdSt|d|dƒ}|dkr®t |||ƒn||ƒ|j j |ƒdS)NFTzset_%s) Útupler"ÚaliasesÚgetr$ÚKeyErrorr<Ú ExceptionrÚsetattrr#r) r5Z option_namer&Úunknownr"Z current_valueZ skip_optionÚparserÚsetterrrrÚ __setitem__šs0   zConfigHandler.__setitem__ú,cCs8t|tƒr|Sd|kr |jƒ}n |j|ƒ}dd„|DƒS)z×Represents value as a list. Value is split either by separator (defaults to comma) or by lines. :param value: :param separator: List items separator character. :rtype: list Ú cSsg|]}|jƒr|jƒ‘qSr)r3)Ú.0Úchunkrrrú Òsz-ConfigHandler._parse_list..)Ú isinstanceÚlistÚ splitlinesÚsplit)Úclsr&Ú separatorrrrÚ _parse_listÀs   zConfigHandler._parse_listcCsTd}i}xF|j|ƒD]8}|j|ƒ\}}}||krsz,ConfigHandler._parse_file..rGrHc3s2|]*}ˆj|ƒsdrtjj|ƒrˆj|ƒVqdS)TN)Ú _assert_localrrrÚ _read_file)rIr)rPrrr` s)rLr r1ÚlenrOÚjoin)rPr&Zinclude_directiveÚspecZ filepathsr)rPrÚ _parse_fileðs   zConfigHandler._parse_filecCs|jtjƒƒstd|ƒ‚dS)Nz#`file:` directive can not access %s)r1rrr)rrrrraszConfigHandler._assert_localc Cs"tj|dd�� }|jƒSQRXdS)Nzutf-8)Úencoding)ÚioÚopenÚread)rÚfrrrrbszConfigHandler._read_filec Csþd}|j|ƒs|S|j|dƒjƒjdƒ}|jƒ}dj|ƒ}|p@d}tjƒ}|rÂ|d|kr¤||d}|jddƒ} t | ƒdkržtj jtjƒ| dƒ}| d}qÂ|}nd|krÂtj jtjƒ|dƒ}t j j d|ƒzt |ƒ} t| |ƒ}Wdt j dd…t _ X|S) z·Represents value as a module attribute. Examples: attr: package.attr attr: package.module.attr :param str value: :rtype: str zattr:r.r/r8rú/éN)r1r2r3rOÚpoprdrrÚrsplitrcrÚsysÚinsertrr$) rPr&r*Zattr_directiveZ attrs_pathZ attr_nameZ module_nameÚ parent_pathZ custom_pathÚpartsÚmodulerrrÚ _parse_attrs0        zConfigHandler._parse_attrcs‡fdd„}|S)z¹Returns parser function to represents value as a list. Parses a value applying given methods one after another. :param parse_methods: :rtype: callable cs|}xˆD] }||ƒ}q W|S)Nr)r&ÚparsedÚmethod)Ú parse_methodsrrr Qs  z1ConfigHandler._get_parser_compound..parser)rPrxr r)rxrÚ_get_parser_compoundHs z"ConfigHandler._get_parser_compoundcCs:i}|pdd„}x$|jƒD]\}\}}||ƒ||<qW|S)zÊParses section options into a dictionary. Optionally applies a given parser to values. :param dict section_options: :param callable values_parser: :rtype: dict cSs|S)Nr)rYrrrÚfsz6ConfigHandler._parse_section_to_dict..)r0)rPr7Z values_parserr&rWÚ_rYrrrÚ_parse_section_to_dict[s  z$ConfigHandler._parse_section_to_dictc Cs@x:|jƒD].\}\}}y |||<Wq tk r6Yq Xq WdS)zQParses configuration file section. :param dict section_options: N)r0r@)r5r7Únamer{r&rrrÚ parse_sectionks  zConfigHandler.parse_sectioncCsfx`|jjƒD]R\}}d}|r$d|}t|d|jddƒdƒ}|dkrVtd|j|fƒ‚||ƒq WdS)zTParses configuration file items from one or more related sections. r.z_%szparse_section%sr/Ú__Nz0Unsupported distribution option section: [%s.%s])r4r0r$r2rr!)r5r6r7Zmethod_postfixZsection_parser_methodrrrr wszConfigHandler.parse)F)rG)N)N)r;Ú __module__Ú __qualname__Ú__doc__r!r>r8Úpropertyr<rFÚ classmethodrRrZr_rfÚ staticmethodrarbruryr|r~r rrrrr-ts(  &     ,   r-csHeZdZdZdddddœZdZd‡fd d „ Zed d „ƒZd d„Z ‡Z S)r(r)ZurlÚ descriptionÚ classifiersÚ platforms)Z home_pageZsummaryZ classifierÚplatformFNcstt|ƒj|||ƒ||_dS)N)Úsuperr(r8r*)r5r"r+rr*)r:rrr8¡szConfigMetadataHandler.__init__c Cs8|j}|j}|j}||||||j||ƒ||||j|dœ S)z.Metadata item name to parser function mapping.) rˆÚkeywordsZprovidesZrequiresZ obsoletesr‡Úlicenser†Zlong_descriptionÚversionZ project_urls)rRrfrZryÚ_parse_version)r5Ú parse_listZ parse_fileÚ parse_dictrrrr<§s zConfigMetadataHandler.parserscCsŠ|j|ƒ}||kr<|jƒ}tt|ƒtƒr8td||fƒ‚|S|j||jƒ}t|ƒrX|ƒ}t|t ƒs†t |dƒr~dj t t |ƒƒ}nd|}|S)zSParses `version` option value. :param value: :rtype: str z7Version loaded from %s does not comply with PEP 440: %sÚ__iter__r/z%s)rfr3rLr r rrur*Úcallabler ÚhasattrrdÚmapÚstr)r5r&r�rrrr޼s    z$ConfigMetadataHandler._parse_version)FN) r;r€r�r!r>Z strict_moder8rƒr<rŽÚ __classcell__rr)r:rr(�s r(c@sTeZdZdZedd„ƒZdd„Zdd„Zdd „Zd d „Z d d „Z dd„Z dd„Z dS)r'r+cCsL|j}t|jdd�}|j}|j}|||||||||||||||j|j|dœS)z.Metadata item name to parser function mapping.ú;)rQ)Zzip_safeZuse_2to3Zinclude_package_datar*Zuse_2to3_fixersZuse_2to3_exclude_fixersZconvert_2to3_doctestsÚscriptsZeager_resourcesZdependency_linksZnamespace_packagesZinstall_requiresZsetup_requiresZ tests_requireZpackagesÚ entry_pointsZ py_modules)rRrr_rZÚ_parse_packagesrf)r5r�Zparse_list_semicolonZ parse_boolr�rrrr<ás*zConfigOptionsHandler.parserscCsBd}|j|ƒs|j|ƒS|j|jjdiƒƒ}ddlm}|f|ŽS)zTParses `packages` option value. :param value: :rtype: list zfind:z packages.findr)Ú find_packages)r1rRÚparse_section_packages__findr4r?Z setuptoolsr›)r5r&Zfind_directiveÚ find_kwargsr›rrrršýs   z$ConfigOptionsHandler._parse_packagescsT|j||jƒ}dddg‰t‡fdd„|jƒDƒƒ}|jdƒ}|dk rP|d|d<|S)zœParses `packages.find` configuration file section. To be used in conjunction with _parse_packages(). :param dict section_options: ÚwhereÚincludeÚexcludecs$g|]\}}|ˆkr|r||f‘qSrr)rIÚkÚv)Ú valid_keysrrrKszEConfigOptionsHandler.parse_section_packages__find..Nr)r|rRr r0r?)r5r7Z section_datar�ržr)r£rrœs    z1ConfigOptionsHandler.parse_section_packages__findcCs|j||jƒ}||d<dS)z`Parses `entry_points` configuration file section. :param dict section_options: r™N)r|rR)r5r7rvrrrÚparse_section_entry_points%sz/ConfigOptionsHandler.parse_section_entry_pointscCs.|j||jƒ}|jdƒ}|r*||d<|d=|S)NÚ*r.)r|rRr?)r5r7rvÚrootrrrÚ_parse_package_data-s  z(ConfigOptionsHandler._parse_package_datacCs|j|ƒ|d<dS)z`Parses `package_data` configuration file section. :param dict section_options: Z package_dataN)r§)r5r7rrrÚparse_section_package_data7sz/ConfigOptionsHandler.parse_section_package_datacCs|j|ƒ|d<dS)zhParses `exclude_package_data` configuration file section. :param dict section_options: Zexclude_package_dataN)r§)r5r7rrrÚ"parse_section_exclude_package_data>sz7ConfigOptionsHandler.parse_section_exclude_package_datacCs"t|jdd�}|j||ƒ|d<dS)zbParses `extras_require` configuration file section. :param dict section_options: r—)rQZextras_requireN)rrRr|)r5r7r�rrrÚparse_section_extras_requireFsz1ConfigOptionsHandler.parse_section_extras_requireN) r;r€r�r!rƒr<ršrœr¤r§r¨r©rªrrrrr'Ýs  r')FF)F)Z __future__rrrhrrpÚ collectionsrÚ functoolsrÚ importlibrZdistutils.errorsrrZ#setuptools.extern.packaging.versionr r Zsetuptools.extern.sixr rrrÚobjectr-r(r'rrrrÚs"     . M