CasperSecurity

Current Path : /lib/python3/dist-packages/setuptools/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/setuptools/__pycache__/config.cpython-310.pyc

o

�_�aqZ�@sddlZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddl
Z
ddlmZmZddlmZmZddlmZGd	d
�d
�Ze
jdd��Zddd�Zdd�Zdd�Zddd�ZGdd�d�ZGdd�de�ZGdd�de�ZdS)�N)�defaultdict)�partial��wraps)�iglob)�DistutilsOptionError�DistutilsFileError)�Version�InvalidVersion)�SpecifierSetc@s eZdZdZdd�Zdd�ZdS)�StaticModulez0
    Attempt to load the module by the name
    cCs`tj�|�}t|j��}|��}Wd�n1swYt�|�}t|��	t
��|`dS�N)�	importlib�util�	find_spec�open�origin�read�ast�parse�vars�update�locals�self)r�name�spec�strm�src�module�r�3/usr/lib/python3/dist-packages/setuptools/config.py�__init__s
�
zStaticModule.__init__c
sNzt�fdd�|jjD��WSty&}ztdjdit����|�d}~ww)Nc3sJ�|] }t|tj�r"|jD]}t|tj�r!|j�kr
t�|j�Vq
qdSr
)�
isinstancer�Assign�targets�Name�id�literal_eval�value)�.0�	statement�target��attrrr �	<genexpr>#s�
��
�

��z+StaticModule.__getattr__.<locals>.<genexpr>z#{self.name} has no attribute {attr}r)�nextr�body�	Exception�AttributeError�formatr)rr-�err,r �__getattr__!s
�����zStaticModule.__getattr__N)�__name__�
__module__�__qualname__�__doc__r!r5rrrr rsrc	cs8�ztj�d|�dVWtj�|�dStj�|�w)zH
    Add path to front of sys.path for the duration of the context.
    rN)�sys�path�insert�remove)r;rrr �
patch_path0s
�r>Fc		Cs�ddlm}m}tj�|�}tj�|�std|��t��}t�	tj�
|��z-|�}|r1|��ng}||vr<|�|�|j
||d�t||j|d�}Wt�	|�t|�St�	|�w)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_errors)�setuptools.distr?r@�osr;�abspath�isfiler�getcwd�chdir�dirname�find_config_files�append�parse_config_files�parse_configuration�command_options�configuration_to_dict)	�filepath�find_othersrBr?r@�current_directory�distrA�handlersrrr �read_configuration<s$
�
�rUcCs2djdit���}t�t||�}t|||�}|�S)z�
    Given a target object and option key, get that option from
    the target object, either through a get_{key} method or
    from an attribute directly.
    z	get_{key}Nr)r3r�	functoolsr�getattr)�
target_obj�key�getter_name�by_attribute�getterrrr �_get_optionisr]cCs<tt�}|D]}|jD]}t|j|�}|||j|<qq|S)z�Returns configuration data gathered by given handlers as a dict.

    :param list[ConfigHandler] handlers: Handlers list,
        usually from parse_configuration()

    :rtype: dict
    )r�dict�set_optionsr]rX�section_prefix)rT�config_dict�handler�optionr(rrr rOus
�rOcCs6t|||�}|��t|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)�distributionrNrB�options�metarrr rM�s�rMc@s�eZdZdZdZ	iZ	d'dd�Zedd��Zdd	�Z	e
d(dd��Ze
d(d
d��Ze
dd��Z
e
dd��Ze
dd��Ze
dd��Zedd��Zedd��Ze
d)dd��Ze
dd��Ze
d)dd ��Zd!d"�Zd#d$�Zd%d&�ZdS)*�
ConfigHandlerz1Handles metadata supplied in configuration files.NFcCs^i}|j}|��D]\}}|�|�sq	|�|d��d�}|||<q	||_||_||_g|_dS)N��.)	r`�items�
startswith�replace�striprBrX�sectionsr_)rrXrirBrrr`�section_name�section_optionsrrr r!�s


zConfigHandler.__init__cCstd|jj��)�.Metadata item name to parser function mapping.z!%s must provide .parsers property)�NotImplementedError�	__class__r6)rrrr �parsers�s
�zConfigHandler.parsersc	Cs�t�}|j}|j�||�}t|||�}||urt|��|rdSd}|j�|�}|r?z||�}Wnty>d}|js<�Ynw|rCdSt|d|d�}|durVt	|||�n||�|j
�|�dS)NFTzset_%s)�tuplerX�aliases�getrW�KeyErrorrxr1rB�setattrr_rK)	r�option_namer(�unknownrX�
current_value�skip_option�parser�setterrrr �__setitem__�s4��zConfigHandler.__setitem__�,cCs8t|t�r|Sd|vr|��}n|�|�}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|]
}|��r|���qSr)rq)r)�chunkrrr �
<listcomp>sz-ConfigHandler._parse_list.<locals>.<listcomp>)r"�list�
splitlines�split)�clsr(�	separatorrrr �_parse_list�s



zConfigHandler._parse_listc	sjd}|j�|d�}g}|D]%�t�fdd�|D��r-|�tdd�ttj����D���q
|���q
|S)aEquivalent to _parse_list() but expands any glob patterns using glob().

        However, unlike with glob() calls, the results remain relative paths.

        :param value:
        :param separator: List items separator character.
        :rtype: list
        )�*�?�[�]�{�}�r�c3s�|]}|�vVqdSr
r)r)�char�r(rr r.s�z1ConfigHandler._parse_list_glob.<locals>.<genexpr>css"�|]}tj�|t���VqdSr
)rDr;�relpathrG�r)r;rrr r.s
��
�)	r��any�extend�sortedrrDr;rErK)r�r(r��glob_characters�values�expanded_valuesrr�r �_parse_list_globs
�zConfigHandler._parse_list_globcCsPd}i}|�|�D]}|�|�\}}}||krtd|��|��||��<q	|S)zPRepresents value as a dict.

        :param value:
        :rtype: dict
        �=z(Unable to parse option value to dict: %s)r��	partitionrrq)r�r(r��result�linerY�sep�valrrr �_parse_dict s�zConfigHandler._parse_dictcCs|��}|dvS)zQRepresents value as boolean.

        :param value:
        :rtype: bool
        )�1�true�yes)�lower)r�r(rrr �_parse_bool3szConfigHandler._parse_boolc��fdd�}|S)z�Returns a parser function to make sure field inputs
        are not files.

        Parses a value after getting the key so error messages are
        more informative.

        :param key:
        :rtype: callable
        cs d}|�|�rtd�����|S)N�file:zCOnly strings are accepted for the {0} field, files are not accepted)ro�
ValueErrorr3)r(�exclude_directive�rYrr r�Is
�z3ConfigHandler._exclude_files_parser.<locals>.parserr)r�rYr�rr�r �_exclude_files_parser=s	z#ConfigHandler._exclude_files_parsercs\d}t|t�s	|S|�|�s|S|t|�d�}dd�|�d�D�}d��fdd�|D��S)aORepresents value as a string, allowing including text
        from nearest files using `file:` directive.

        Directive is sandboxed and won't reach anything outside
        directory with setup.py.

        Examples:
            file: README.rst, CHANGELOG.md, src/file.txt

        :param str value:
        :rtype: str
        r�Ncss �|]}tj�|���VqdSr
)rDr;rErqr�rrr r.ks�z,ConfigHandler._parse_file.<locals>.<genexpr>r�r�c3s4�|]}��|�s		tj�|�r��|�VqdS)TN)�
_assert_localrDr;rF�
_read_filer��r�rr r.ls���
�
�)r"�strro�lenr��join)r�r(�include_directiver�	filepathsrr�r �_parse_fileTs

�zConfigHandler._parse_filecCs|�t���s
td|��dS)Nz#`file:` directive can not access %s)rorDrGr)rPrrr r�rs�zConfigHandler._assert_localcCs:tj|dd��}|��Wd�S1swYdS)Nzutf-8)�encoding)�iorr)rP�frrr r�ws$�zConfigHandler._read_filec	Cs0d}|�|�s	|S|�|d����d�}|��}d�|�}|p d}t��}|ra|d|vrR||d}|�dd�}	t	|	�dkrOtj
�t��|	d�}|	d}n|}nd|vratj
�t��|d�}t|��&ztt
|�|�WWd�Sty�t�|�}
YnwWd�n1s�wYt|
|�S)	z�Represents value as a module attribute.

        Examples:
            attr: package.attr
            attr: package.module.attr

        :param str value:
        :rtype: str
        zattr:rlrmr!r�/�N)rorprqr��popr�rDrG�rsplitr�r;r>rWrr1r�
import_module)r�r(rg�attr_directive�
attrs_path�	attr_name�module_name�parent_path�custom_path�partsrrrr �_parse_attr|s8



���
zConfigHandler._parse_attrcr�)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|}�D]}||�}q|Sr
r)r(�parsed�method��
parse_methodsrr r�s
z1ConfigHandler._get_parser_compound.<locals>.parser)r�r�rrr�r �_get_parser_compound�s
z"ConfigHandler._get_parser_compoundcCs6i}|pdd�}|��D]\}\}}||�||<q|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|Sr
r)r�rrr �<lambda>�sz6ConfigHandler._parse_section_to_dict.<locals>.<lambda>)rn)r�rt�
values_parserr(rY�_r�rrr �_parse_section_to_dict�s

z$ConfigHandler._parse_section_to_dictc	Cs8|��D]\}\}}z|||<WqtyYqwdS)zQParses configuration file section.

        :param dict section_options:
        N)rnr|)rrtrr�r(rrr �
parse_section�s��zConfigHandler.parse_sectioncCsb|j��D])\}}d}|rd|}t|d|�dd�d�}|dur*td|j|f��||�qdS)zTParses configuration file items from one
        or more related sections.

        rlz_%szparse_section%srm�__Nz0Unsupported distribution option section: [%s.%s])rrrnrWrprr`)rrsrt�method_postfix�section_parser_methodrrr r�s"���
�zConfigHandler.parsecst�����fdd��}|S)z�this function will wrap around parameters that are deprecated

        :param msg: deprecation message
        :param warning_class: class of warning exception to be raised
        :param func: function to be wrapped around
        cst�����|i|��Sr
)�warnings�warn)�args�kwargs��func�msg�
warning_classrr �config_handler�sz@ConfigHandler._deprecated_config_handler.<locals>.config_handlerr)rr�r�r�r�rr�r �_deprecated_config_handler�sz(ConfigHandler._deprecated_config_handler�F)r�r
)r6r7r8r9r`rzr!�propertyrxr��classmethodr�r�r�r�r�r��staticmethodr�r�r�r�r�r�rr�rrrr rk�sF

&

	



-
rkcsLeZdZdZddddd�ZdZ		d�fd	d
�	Zedd��Zd
d�Z	�Z
S)rerf�url�description�classifiers�	platforms)�	home_page�summary�
classifier�platformFNcstt|��|||�||_dSr
)�superrer!rg)rrXrirBrg�rwrr r!s
�
zConfigMetadataHandler.__init__cCs^|j}|j}|j}|j}||||�|dt�||�||�|d�|�|d�dt�||||j|d�
S)ruz[The requires parameter is deprecated, please use install_requires for runtime dependencies.�license�license_filezDThe license_file parameter is deprecated, use license_files instead.)
r��keywords�provides�requires�	obsoletesr�r�r��
license_filesr��long_description�version�project_urls)r�r�r�r�r��DeprecationWarningr��_parse_version)r�
parse_list�
parse_file�
parse_dict�exclude_files_parserrrr rxs4�
��zConfigMetadataHandler.parserscCs�|�|�}||kr)|��}zt|�W|Sty(d}t|jdit�����w|�||j�}t	|�r7|�}t
|t�sOt|d�rKd�
tt|��}|Sd|}|S)zSParses `version` option value.

        :param value:
        :rtype: str

        zCVersion loaded from {value} does not comply with PEP 440: {version}�__iter__rmz%sNr)r�rqr	r
rr3rr�rg�callabler"r��hasattrr��map)rr(r��tmplrrr r�?s(

���	

�z$ConfigMetadataHandler._parse_version)FN)r6r7r8r`rz�strict_moder!r�rxr��
__classcell__rrr�r res��
!rec@sdeZdZdZedd��Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�ZdS)rdricCsN|j}t|jdd�}|j}|j}|j}|||||||||||j|j|t|d�S)ru�;r�)�zip_safe�include_package_datarg�scripts�eager_resources�dependency_links�namespace_packages�install_requires�setup_requires�
tests_require�packages�entry_points�
py_modules�python_requires�cmdclass)r�rr�r��_parse_cmdclass�_parse_packagesr�r)rr��parse_list_semicolon�
parse_boolr��parse_cmdclassrrr rxis*�zConfigOptionsHandler.parserscs$dd���fdd�|�|���D�S)NcSs8|�d�}||dd�}|d|�}t|�}t||�S)Nrmr�)�rfind�
__import__rW)�qualified_class_name�idx�
class_name�pkg_namerrrr �
resolve_class�s


z;ConfigOptionsHandler._parse_cmdclass.<locals>.resolve_classcsi|]	\}}|�|��qSrr�r)�k�v�r"rr �
<dictcomp>�sz8ConfigOptionsHandler._parse_cmdclass.<locals>.<dictcomp>)r�rn)rr(rr&r r�s	z$ConfigOptionsHandler._parse_cmdclasscCsnddg}|��}||vr|�|�S||dk}|�|j�di��}|r*ddlm}nddlm}|d	i|��S)
zTParses `packages` option value.

        :param value:
        :rtype: list
        zfind:zfind_namespace:r�z
packages.findr)�find_namespace_packages)�
find_packagesNr)rqr��parse_section_packages__findrrr{�
setuptoolsr(r))rr(�find_directives�
trimmed_value�findns�find_kwargsr)rrr r�s
�z$ConfigOptionsHandler._parse_packagescsR|�||j�}gd��t�fdd�|��D��}|�d�}|dur'|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|]\}}|�vr|r||f�qSrrr#��
valid_keysrr r��s$zEConfigOptionsHandler.parse_section_packages__find.<locals>.<listcomp>r0Nr)r�r�r^rnr{)rrt�section_datar/r0rr3r r*�s�
z1ConfigOptionsHandler.parse_section_packages__findcCs|�||j�}||d<dS)z`Parses `entry_points` configuration file section.

        :param dict section_options:
        rN)r�r��rrtr�rrr �parse_section_entry_points�sz/ConfigOptionsHandler.parse_section_entry_pointscCs.|�||j�}|�d�}|r||d<|d=|S)Nr�rl)r�r�r{)rrtr��rootrrr �_parse_package_data�s
z(ConfigOptionsHandler._parse_package_datacC�|�|�|d<dS)z`Parses `package_data` configuration file section.

        :param dict section_options:
        �package_dataN�r9�rrtrrr �parse_section_package_data��z/ConfigOptionsHandler.parse_section_package_datacCr:)zhParses `exclude_package_data` configuration file section.

        :param dict section_options:
        �exclude_package_dataNr<r=rrr �"parse_section_exclude_package_data�r?z7ConfigOptionsHandler.parse_section_exclude_package_datacCs"t|jdd�}|�||�|d<dS)zbParses `extras_require` configuration file section.

        :param dict section_options:
        rr��extras_requireN)rr�r�)rrtr�rrr �parse_section_extras_require�s�z1ConfigOptionsHandler.parse_section_extras_requirecCs(|�||j�}dd�|��D�|d<dS)z^Parses `data_files` configuration file section.

        :param dict section_options:
        cSsg|]\}}||f�qSrrr#rrr r��szAConfigOptionsHandler.parse_section_data_files.<locals>.<listcomp>�
data_filesN)r�r�rnr6rrr �parse_section_data_files�sz-ConfigOptionsHandler.parse_section_data_filesN)r6r7r8r`r�rxrrr*r7r9r>rArCrErrrr rdes


rd)FFr�) rr�rDr:r�rVr�collectionsrrr�globr�
contextlib�distutils.errorsrr�#setuptools.extern.packaging.versionr	r
�&setuptools.extern.packaging.specifiersrr�contextmanagerr>rUr]rOrMrkrerdrrrr �<module>s6

-
ca
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY