uawdijnntqw1x1x1
IP : 3.14.255.58
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
..
/
lib64
/
apr-util-1
/
..
/
td-agent-bit
/
..
/
python3.6
/
__pycache__
/
modulefinder.cpython-36.pyc
/
/
3 \�Y�@sdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z e j��e jde �ddlZWdQRXejdZejdZejdZejdZeefZejZiZdd �ZiZd d�ZGdd �d �ZGdd�d�Zdd�Zedk�ry e�ZWnek �re d�YnXdS)z3Find modules used by a script, using introspection.�N�ignore� LOAD_CONST�IMPORT_NAME� STORE_NAME�STORE_GLOBALcCstj|g�j|�dS)N)�packagePathMap� setdefault�append)Zpackagename�path�r�$/usr/lib64/python3.6/modulefinder.py�AddPackagePath sr cCs|t|<dS)N)�replacePackageMap)Zoldname�newnamerrr�ReplacePackage+src@seZdZddd�Zdd�ZdS)�ModuleNcCs(||_||_||_d|_i|_i|_dS)N)�__name__�__file__�__path__�__code__�globalnames�starimports)�self�name�filer rrr�__init__1szModule.__init__cCsLd|jf}|jdk r&|d|jf}|jdk r@|d|jf}|d}|S)Nz Module(%rz, %r�))rrr)r�srrr�__repr__>s zModule.__repr__)NN)r� __module__�__qualname__rrrrrrr/s rc@s�eZdZddggfdd�Zdd�Zdd�Zd d �Zdd�Zd d�Zd7dd�Z d9dd�Z dd�Zdd�Zd:dd�Z dd�Zdd�Zdd�Zd d!�Zd<d"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd=d,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�ZdS)>�ModuleFinderNrcCsB|dkrtj}||_i|_i|_||_d|_||_||_g|_dS)Nr) �sysr �modules� badmodules�debug�indent�excludes� replace_paths�processed_paths)rr r%r'r(rrrrIszModuleFinder.__init__cGs^||jkrZxt|j�D]}tddd�qWt|dd�x|D]}tt|�dd�q<Wt�dS)Nz � )�end)r%�ranger&�print�repr)r�level�str�args�i�argrrr�msgUs zModuleFinder.msgcGs,|d}||jkr(|jd|_|j|�dS)Nr�)r%r&r4)rr1r/rrr�msgin^s zModuleFinder.msgincGs,|d}||jkr(|jd|_|j|�dS)Nrr5)r%r&r4)rr1r/rrr�msgoutds zModuleFinder.msgoutcCsB|jdd|�t|��"}ddtjf}|jd|||�WdQRXdS)N�� run_script��r�__main__)r4�open�imp� PY_SOURCE�load_module)r�pathname�fp�stuffrrrr9js zModuleFinder.run_scriptcCsTtjj|�\}}tjj|�\}}t|��"}|dtjf}|j||||�WdQRXdS)Nr;)�osr �split�splitextr=r>r?r@)rrA�dirrZextrBrCrrr� load_fileps zModuleFinder.load_filer5c Cs\|jdd||||�|j||d�}|j||�\}}|j||�}|sF|S|jrX|j||�dS)N��import_hook)r/)r4�determine_parent�find_head_package� load_tailr�ensure_fromlist) rr�caller�fromlistr/�parent�q�tail�mrrrrJwszModuleFinder.import_hookcCsP|jdd||�|s|dkr.|jdd�dS|j}|dkr�|jrJ|d8}|dkrz|j|}||ksht�|jdd|�|S|jd�|kr�td��dj|j d�d|��}|j|}|jdd|�|S|jr�|j|}||ks�t�|jdd|�|Sd|k�r@|j d�}|d|�}|j|}|j|k�s.t�|jdd|�|S|jdd�dS) N�rKrzdetermine_parent -> Noner5zdetermine_parent ->�.zrelative importpath too deep)r6r7rrr#�AssertionError�count�ImportError�joinrE�rfind)rrOr/ZpnamerQr2rrrrK�sB zModuleFinder.determine_parentcCs�|jdd||�d|kr@|jd�}|d|�}||dd�}n|}d}|r\d|j|f}n|}|j|||�}|r�|jdd||f�||fS|r�|}d}|j|||�}|r�|jdd||f�||fS|jdd|�td |��dS) NrUrLrVr5r:z%s.%szfind_head_package ->z"raise ImportError: No module namedzNo module named )r6�findr� import_moduler7rY)rrQrr2�headrSZqnamerRrrrrL�s. zModuleFinder.find_head_packagecCs�|jdd||�|}xz|r�|jd�}|dkr4t|�}|d|�||dd�}}d|j|f}|j|||�}|s|jdd|�td|��qW|jdd |�|S) NrUrMrVrr5z%s.%sz"raise ImportError: No module namedzNo module named zload_tail ->)r6r\�lenrr]r7rY)rrRrSrTr2r^ZmnamerrrrM�s zModuleFinder.load_tailcCs�|jdd|||�xl|D]d}|dkrF|s||j|�}|r||j||d�qt||�sd|j|f}|j|||�}|std|��qWdS)NrUrN�*r5z%s.%szNo module named )r4�find_all_submodulesrN�hasattrrr]rY)rrTrP� recursive�sub�all�subnameZsubmodrrrrN�s zModuleFinder.ensure_fromlistc Cs�|js dSi}g}|tjjdd�7}|tjjdd�7}|tjjdd�7}x�|jD]�}ytj|�}Wn$tk r�|j dd|�wVYnXx\|D]T}d}x6|D].}t |�} || d�|kr�|d| �}Pq�W|r�|dkr�|||<q�WqVW|j�S)Nr8zcan't list directoryr)r� importlib� machinery�EXTENSION_SUFFIXES�SOURCE_SUFFIXES�BYTECODE_SUFFIXESrD�listdir�OSErrorr4r_�keys) rrTr#�suffixesrG�namesr�modZsuff�nrrrra�s. z ModuleFinder.find_all_submodulescCs|jdd|||�y|j|}Wntk r4YnX|jdd|�|S||jkrb|jdd�dS|r�|jdkr�|jdd�dSy|j||o�|j|�\}}}Wn"tk r�|jddd�dSXz|j||||�}Wd|r�|j �X|r�t |||�|jdd|�|S)NrIr]zimport_module ->zimport_module -> None)r6r#�KeyErrorr7r$r�find_modulerYr@�close�setattr)rZpartname�fqnamerQrTrBrArCrrrr]�s6 zModuleFinder.import_modulecCs|\}}}|jdd||od|�|tjkrH|j||�}|jdd|�|S|tjkrht|j�d|d�} nj|tjkr�yt j j|j��} Wn:tk r�}z|jddt |�|��WYdd}~XnXtj| �} nd} |j|�}||_| �r |jr�|j| �} | |_|j| |�|jdd|�|S)Nr8r@rBzload_module ->� �execzraise ImportError: )r6r>Z PKG_DIRECTORY�load_packager7r?�compile�readZPY_COMPILEDrg�_bootstrap_external�_validate_bytecode_headerrYr0�marshal�loads� add_modulerr(�replace_paths_in_coder� scan_code)rrwrBrA� file_info�suffix�mode�typerT�coZmarshal_data�excrrrr@s2 zModuleFinder.load_modulecCs<||jkri|j|<|r*d|j||j<nd|j|d<dS)Nr5�-)r$r)rrrOrrr�_add_badmodule4s zModuleFinder._add_badmodulecCs||jkr|j||�dSy|j|||d�Wn@tk rn}z$|jddt|��|j||�WYdd}~Xn�X|�rx�|D]�}||jkr�|j||�q|y|j|||g|d�Wq|tk r�}z0|jddt|��|d|}|j||�WYdd}~Xq|Xq|WdS)N)r/r8zImportError:rV)r$r�rJrYr4r0)rrrOrPr/r4rd�fullnamerrr�_safe_import_hook<s& zModuleFinder._safe_import_hookccs�|j}|j}|j}dd�tj|�D�}x�t|�D]�\}\}}|tkrVd||ffVq0|tkr0|dkr0||dd||ddko�tknr0|||dd} |||dd} | dkr�d| ||ffVq0d| | ||ffVq0q0WdS) NcSs"g|]\}}}|tkr||f�qSr)�EXTENDED_ARG)�.0�_�opr3rrr� <listcomp>Xsz-ModuleFinder.scan_opcodes.<locals>.<listcomp>�storer8r5r�absolute_import�relative_import) �co_code�co_names� co_consts�disZ_unpack_opargs� enumerate� STORE_OPSrr)rr��coderp�constsZopargsr2r�Zopargr/rPrrr�scan_opcodesSs 0zModuleFinder.scan_opcodescCs�|j}|j}�xT||�D�]F\}}|dkr<|\}d|j|<q|dk�r|\}}d} |dk rtd|krfd} dd�|D�}|j|||dd�| �r`d} |jr�|jj|jd |�} | dkr�|jj|�} | dk r�|jj| j�|j j| j �| j dkr�d|j |<n d|j |<q|d k�rX|\}}}|�r4|j||||d�n"|j||d�}|j|jd|dd�qt|��qWx,|j D]"} t| t|���rl|j| |��qlWdS)Nr�r5r�rr`cSsg|]}|dkr|�qS)r`r)r��frrrr�usz*ModuleFinder.scan_code.<locals>.<listcomp>)r/rVr�)r�r�rr�rr#�getr�updaterrrK�RuntimeErrorr�� isinstancer�r�)rr�rTr��scannerZwhatr1rrPZ have_starZmmr/rQ�crrrr�hsH zModuleFinder.scan_codecCs�|jdd||�tj|�}|r"|}|j|�}||_|g|_|jtj|g�|_|jd|j�\}}}z"|j||||�|j dd|�|S|r�|j �XdS)Nr8rzrzload_package ->)r6rr�r�rrrrtr@r7ru)rrwrArrTrBZbufrCrrrrz�s zModuleFinder.load_packagecCs*||jkr|j|St|�|j|<}|S)N)r#r)rrwrTrrrr��s zModuleFinder.add_modulecCsr|dk r|jd|}n|}||jkr<|jdd|�t|��|dkrf|tjkr`ddddtjffS|j}tj ||�S)NrVrIzfind_module -> Excludedr:) rr'r7rYr"�builtin_module_namesr>Z C_BUILTINr rt)rrr rQr�rrrrt�s zModuleFinder.find_modulecCs"t�tdd�tdd�t|jj��}xJ|D]B}|j|}|jrTtddd�ntddd�td ||jppd �q2W|j�\}}|r�t�td�x2|D]*}t|j|j��}td|d dj|��q�W|�rt�tddd�td�x2|D]*}t|j|j��}td|d dj|��q�WdS)z�Print a report to stdout, listing the found modules with their paths, as well as modules that are missing, or seem to be missing. z %-25s %s�Name�File�----�Pr*)r+rTz%-25sr:zMissing modules:�?z imported fromz, z7Submodules that appear to be missing, but could also bez#global names in the parent package:N)r�r�)r�r�) r-�sortedr#rnrr�any_missing_mayber$rZ)rrn�keyrT�missing�mayberZmodsrrr�report�s0 zModuleFinder.reportcCs|j�\}}||S)z�Return a list of modules that appear to be missing. Use any_missing_maybe() if you want to know which modules are certain to be missing, and which *may* be missing. )r�)rr�r�rrr�any_missing�szModuleFinder.any_missingcCs�g}g}x�|jD]�}||jkr q|jd�}|dkr>|j|�q||dd�}|d|�}|jj|�}|dk r�||j|kr�|j|�q�||jkr�q�|jr�|j|�q�|j|�q|j|�qW|j�|j�||fS)a�Return two lists, one with modules that are certainly missing and one with modules that *may* be missing. The latter names could either be submodules *or* just global names in the package. The reason it can't always be determined is that it's impossible to tell which names are imported when "from module import *" is done with an extension module, short of actually importing it. rVrr5N) r$r'r[r r#r�rr�sort)rr�r�rr2rfZpkgnameZpkgrrrr��s0 zModuleFinder.any_missing_maybecCstjj|j�}}x2|jD](\}}|j|�r||t|�d�}PqW|jr�||jkr�||krt|j dd||f�n|j dd|f�|jj |�t|j�}x8t t|��D](}t||t|��r�|j||�||<q�Wtj|j|j|j|j|j|jt|�|j|j||j|j|j|j|j �S)Nr8zco_filename %r changed to %rz co_filename %r remains unchanged)!rDr �normpath�co_filenamer(� startswithr_r%r)r7r �listr�r,r�r�r��types�CodeType�co_argcount�co_kwonlyargcount� co_nlocals�co_stacksize�co_flagsr��tupler��co_varnames�co_name�co_firstlineno� co_lnotab�co_freevars�co_cellvars)rr�Znew_filenameZoriginal_filenamer�r;r�r2rrrr�s, z"ModuleFinder.replace_paths_in_code���)NNr�r�)r�)rr�)r�)N)rrr rr4r6r7r9rHrJrKrLrMrNrar]r@r�r�r�r�rzr�rtr�r�r�r�rrrrr!Gs2 # 1 ".r!cCs�ddl}y|jtjdd�d�\}}Wn*|jk rP}zt|�dSd}~XnXd}d}g}g}xb|D]Z\}} |dkr�|d}|dkr�d}|dkr�|| jtj�}|dkr�d}|dkrh|j| �qhW|s�d } n|d} tj dd�}tj j | �|d<||}|dk�r.td �x|D]}tdt|���qWt|||�} xp|dd�D]`}|dk�r^d}�qH|�r�|dd�d k�r�| j |dd�ddg�n | j |�n | j|��qHW| j| �| j�| S)Nrr5zdmp:qx:z-dz-mz-pz-qz-xzhello.pyzpath:z r8z.*r`���r�)�getoptr"�argv�errorr-rErD�pathsepr r �dirnamer.r!rJrHr9r�)r�Zoptsr1r4r%ZdomodsZaddpathZexclude�o�aZscriptr �item�mfr3rrr�test:sX r�r<z [interrupted])!�__doc__r�Zimportlib._bootstrap_externalrg�importlib.machineryrrDr"r�Zstruct�warnings�catch_warnings�simplefilter�DeprecationWarningr>Zopmaprrrrr�r�rr rrrr!r�rr��KeyboardInterruptr-rrrr�<module>sB v;
/home/../lib64/apr-util-1/../td-agent-bit/../python3.6/__pycache__/modulefinder.cpython-36.pyc