OwlCyberSecurity - MANAGER
Edit File: pkgutil.cpython-38.pyc
U ����e5d�S����������������������@���sx��d�Z�ddlmZ�ddlmZ�ddlZddlZddlZddl Z ddl Z ddlZddlm Z �ddlZdddd d ddd ddddgZedd�Zde_�dd��Zdd��Zd+dd �Zd,dd�Zed-dd��Zd.dd�Ze�ejje��dd��ZG�d d ��d �ZG�d!d��d�Zz.ddlZdd"lmZ�d/d#d$�Ze�ee��W�n�e k �r@���Y�nX�d%d��Z!d0d&d�Z"d'd��Z#d(d ��Z$d)d��Z%d*d��Z&dS�)1zUtilities to support packages.�����)� namedtuple)�singledispatchN)� ModuleType�get_importer�iter_importers� get_loader�find_loader� walk_packages�iter_modules�get_data�ImpImporter� ImpLoader� read_code�extend_path� ModuleInfozmodule_finder name ispkgz.A namedtuple with minimal info about a module.c�����������������C���sR���z |�j�}W�n:�tk rD���|��|�}|dkr2Y�dS�tj�||��Y�S�X�||�S�dS�)z'Return the finder-specific module spec.N)� find_spec�AttributeError�find_module� importlib�util�spec_from_loader)�finder�namer����loader��r����/usr/lib64/python3.8/pkgutil.py� _get_spec���s���� r���c�����������������C���s6���dd�l�}|��d�}|tjjkr"d�S�|��d��|�|��S�)Nr�����������)�marshal�readr���r����MAGIC_NUMBER�load)�streamr����magicr���r���r���r���(���s���� ��c�������������� ���#���s����i�fdd���t�|�|�D�]�}|V��|jrzt|j��W�nN�tk rZ���|dk rV||j��Y�q�tk r����|dk r|||j��n��Y�qX�ttj|j�dd�p�g�}���fdd�|�D��}�t |�|jd�|�E�dH��qdS�)a���Yields ModuleInfo for all modules recursively on path, or, if path is None, all accessible modules. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. Note that this function must import all *packages* (NOT all modules!) on the given path, in order to access the __path__ attribute to find submodules. 'onerror' is a function which gets called with one argument (the name of the package which was being imported) if any exception occurs while trying to import a package. If no onerror function is supplied, ImportErrors are caught and ignored, while all other exceptions are propagated, terminating the search. Examples: # list all modules python can access walk_packages() # list all submodules of ctypes walk_packages(ctypes.__path__, ctypes.__name__+'.') c�����������������S���s���|�|krdS�d||�<�d�S�)NTr���)�p�mr���r���r����seenR���s����zwalk_packages.<locals>.seenN�__path__c��������������������s���g�|�]}��|�s|�qS�r���r���)�.0r&����r(���r���r���� <listcomp>i���s������z!walk_packages.<locals>.<listcomp>�.) r ����ispkg� __import__r����ImportError� Exception�getattr�sys�modulesr ���)�path�prefix�onerror�infor���r+���r���r ���5���s ����c�����������������c���sr���|�dkrt���}nt|�t�r$td��n tt|��}i�}|D�]6}t||�D�]&\}}||krDd||<�t|||�V��qDq6dS�)a��Yields ModuleInfo for all submodules on path, or, if path is None, all top-level modules on sys.path. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. Nz9path must be None or list of paths to look for modules in����)r���� isinstance�str� ValueError�mapr����iter_importer_modulesr���)r5���r6���Z importers�yielded�ir���r.���r���r���r���r ���n���s���� c�����������������C���s���t�|�d�sg�S�|��|�S�)Nr ���)�hasattrr ���)�importerr6���r���r���r���r>�������s���� r>���c�������������� ���c���s$��|�j�d�kstj��|�j��sd�S�i�}dd�l}zt�|�j��}W�n�tk rP���g�}Y�nX�|����|D�]�}|�|�}|dks^||kr~q^tj��|�j�|�}d}|s�tj��|�r�d|kr�|}zt�|�} W�n�tk r����g�} Y�nX�| D�]}|�|�} | dkr�d}�q�q�q^|r^d|kr^d||<�||�|fV��q^d�S��Nr����__init__Fr-���Tr9���� r5����os�isdir�inspect�listdir�OSError�sort� getmodulename�join)rB���r6���r?���rH���� filenames�fn�modnamer5���r.����dircontents�subnamer���r���r����_iter_file_finder_modules����s<���� rS���c���������������� ���C���s.���t������t��dt��t�d�aW�5�Q�R�X�d�S�)N�ignore�imp)�warnings�catch_warnings�simplefilter�DeprecationWarningr���� import_modulerU���r���r���r���r����_import_imp����s���� r[���c�������������������@���s.���e�Zd�ZdZd dd�Zddd�Zddd �ZdS�) r���a��PEP 302 Finder that wraps Python's "classic" import algorithm ImpImporter(dirname) produces a PEP 302 finder that searches that directory. ImpImporter(None) produces a PEP 302 finder that searches the current sys.path, plus any modules that are frozen or built-in. Note that ImpImporter does not currently support being used by placement on sys.meta_path. Nc�����������������C���s���t��dt��t���||�_d�S��Nz5This emulation is deprecated, use 'importlib' instead)rV����warnrY���r[���r5���)�selfr5���r���r���r���rD�������s �����zImpImporter.__init__c�����������������C���s����|��d�d�}||kr$|�jd�kr$d�S�|�jd�kr4d�}ntj�|�j�g}zt�||�\}}}W�n�tk rp���Y�d�S�X�t||||�S�)Nr-������)�splitr5���rF����realpathrU���r���r0���r ���)r^����fullnamer5���rR����file�filename�etcr���r���r���r�������s���� zImpImporter.find_moduler%���c�������������� ���c���s$��|�j�d�kstj��|�j��sd�S�i�}dd�l}zt�|�j��}W�n�tk rP���g�}Y�nX�|����|D�]�}|�|�}|dks^||kr~q^tj��|�j�|�}d}|s�tj��|�r�d|kr�|}zt�|�} W�n�tk r����g�} Y�nX�| D�]}|�|�} | dkr�d}�q�q�q^|r^d|kr^d||<�||�|fV��q^d�S�rC���rE���)r^���r6���r?���rH���rN���rO���rP���r5���r.���rQ���rR���r���r���r���r �������s<���� zImpImporter.iter_modules)N)N)r%���)�__name__� __module__�__qualname__�__doc__rD���r���r ���r���r���r���r���r�������s��� c�������������������@���sn���e�Zd�ZdZd�ZZdd��Zdd��Zdd��Zd d ��Z dd��Z d d��Zddd�Zddd�Z dd��Zddd�ZdS�)r ���zBPEP 302 Loader that wraps Python's "classic" import algorithm Nc�����������������C���s.���t��dt��t���||�_||�_||�_||�_d�S�r\���)rV���r]���rY���r[���rc���rd���rb���re���)r^���rb���rc���rd���re���r���r���r���rD�����s�����zImpLoader.__init__c�����������������C���s:���|������zt�||�j|�j|�j�}W�5�|�jr4|�j����X�|S�)N)�_reopenrc����closerU����load_modulerd���re���)r^���rb����modr���r���r���rl�����s����zImpLoader.load_modulec�������������� ���C���s*���t�|d��}|���W��5�Q�R���S�Q�R�X�d�S�)N�rb)�openr ���)r^����pathnamerc���r���r���r���r���%��s����zImpLoader.get_datac�����������������C���sT���|�j�rP|�j�jrP|�jd�}|tjkr2t|�jd�|�_�n|tjtjfkrPt|�jd�|�_�d�S�)N�����rrn���) rc����closedre���rU���� PY_SOURCEro���rd����PY_COMPILED�C_EXTENSION)r^����mod_typer���r���r���rj���)��s���� zImpLoader._reopenc�����������������C���s0���|d�kr|�j�}n||�j�kr,td|�j�|f���|S�)Nz,Loader for module %s cannot handle module %s)rb���r0����r^���rb���r���r���r���� _fix_name1��s���� �zImpLoader._fix_namec�����������������C���s���|���|�}|�jd�tjkS��Nrq���)ry���re���rU���� PKG_DIRECTORYrx���r���r���r���� is_package9��s���� zImpLoader.is_packagec�����������������C���s����|���|�}|�jd�kr�|�jd�}|tjkrD|��|�}t||�jd�|�_nJ|tjkrv|�� ���zt|�j �|�_W�5�|�j ����X�n|tj kr�|�������|�_|�jS�)Nrq����exec)ry����codere���rU���rt���� get_source�compilerd���ru���rj���rc���rk���r���r{���� _get_delegate�get_code)r^���rb���rw����sourcer���r���r���r����=��s���� zImpLoader.get_codec�������������� ���C���s����|���|�}|�jd�kr�|�jd�}|tjkrP|�����z|�j���|�_W�5�|�j����X�nd|tj kr�t j�|�j d�d���r�t|�j d�d��d��}|���|�_W�5�Q�R�X�n|tjkr�|�������|�_|�jS�)Nrq���r_���rr���)ry���r����re���rU���rt���rj���rc���rk���r ���ru���rF���r5����existsrd���ro���r{���r����r���)r^���rb���rw����fr���r���r���r���N��s���� zImpLoader.get_sourcec�����������������C���s���t�|�j�}t|d�}|jS�)NrD���)r���rd���r���r���)r^���r����specr���r���r���r����`��s���� zImpLoader._get_delegatec�����������������C���sH���|���|�}|�jd�}|tjkr*|�������S�|tjtjtjfkrD|�j S�d�S�rz���) ry���re���rU���r{���r�����get_filenamert���ru���rv���rd���)r^���rb���rw���r���r���r���r����e��s���� zImpLoader.get_filename)N)N)N)rf���rg���rh���ri���r~���r����rD���rl���r���rj���ry���r|���r����r���r����r����r���r���r���r���r �����s��� )�zipimporterc����������� ������c���s����t�tj|�j��}|�j}t|�}i�}dd�l}|D�]�}|�|�s>q.||d����t j �}t|�dkr�|d��d�r�|d�|kr�d||d�<�||d��dfV��t|�dkr�q.|�|d��}|dkr�q.|r.d|kr.||kr.d||<�||�dfV��q.d�S�) Nr���rq���r9���z__init__.pyTrD���r-���F)�sorted� zipimport�_zip_directory_cache�archiver6����lenrH���� startswithr`���rF����seprL���) rB���r6���Zdirlist�_prefixZplenr?���rH���rO���rP���r���r���r����iter_zipimport_moduless��s*���� r����c�����������������C���sx���t��|��}�ztj|��}W�nZ�tk rr���tjD�]:}z ||��}tj�|�|��W��qnW�q.�tk rf���Y�q.X�q.d}Y�nX�|S�)z�Retrieve a finder for the given path item The returned finder is cached in sys.path_importer_cache if it was newly created by a path hook. The cache (or part of it) can be cleared manually if a rescan of sys.path_hooks is necessary. N)rF����fsdecoder3����path_importer_cache�KeyError� path_hooks� setdefaultr0���)Z path_itemrB���� path_hookr���r���r���r������s���� c�����������������c���s����|���d�rd�|��}t|��d|�krV|��d�d�}t�|�}t|dd�}|dkrhdS�ntjE�dH��tj }|D�]}t |�V��qldS�)a���Yield finders for the given module name If fullname contains a '.', the finders will be for the package containing fullname, otherwise they will be all registered top level finders (i.e. those on both sys.meta_path and sys.path_hooks). If the named module is in a package, that package is imported as a side effect of invoking this function. If no module name is specified, all top level finders are produced. r-����'Relative module name {!r} not supportedr���r)���N)r�����formatr0���� rpartitionr���rZ���r2���r3���� meta_pathr5���r���)rb����msgZpkg_nameZpkgr5����itemr���r���r���r������s���� c�����������������C���sn���|�t�jkr t�j|��}�|�dkr dS�t|�t�rb|�}t|dd�}|dk rF|S�t|dd�dkrZdS�|j}n|�}t|�S�)z�Get a "loader" object for module_or_name Returns None if the module cannot be found or imported. If the named module is not already imported, its containing package (if any) is imported, in order to establish the package __path__. N� __loader__�__spec__)r3���r4���r:���r���r2���rf���r���)Zmodule_or_name�moduler���rb���r���r���r���r������s���� c�����������������C���s����|���d�rd�|��}t|��ztj�|��}W�nF�ttttfk rr�}�z d}t|�|�t |�|��|�W�5�d}~X�Y�nX�|dk r�|j S�dS�)z�Find a "loader" object for fullname This is a backwards compatibility wrapper around importlib.util.find_spec that converts most failures to ImportError and only returns the loader rather than the full spec r-���r����z,Error while finding loader for {!r} ({}: {})N)r����r����r0���r���r���r���r���� TypeErrorr<����typer���)rb���r����r����Zexr���r���r���r������s���� *c�����������������C���s���t�|�t�s|�S�|d�}|�dd��}�|�d�\}}}|rfztj|�j}W�ql�ttfk rb���|��Y�S�X�ntj}|D��]&}t�|t �s�qpt |�}|dk r�g�} t|d�r�|�|�} | dk r�| j p�g�} nt|d�r�|�|�\}} | D�]}||�kr�|��|��q�tj�||�}tj�|�rpzt|�} W�n8�tk �rP�}�ztj�d||f���W�5�d}~X�Y�qpX�| �<�| D�]0}|�d�}|�r\|�d��r��q\|��|���q\W�5�Q�R�X�qp|�S�) a���Extend a package's path. Intended use is to place the following code in a package's __init__.py: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) This will add to the package's __path__ all subdirectories of directories on sys.path named after the package. This is useful if one wants to distribute different parts of a single logical package as multiple directories. It also looks for *.pkg files beginning where * matches the name argument. This feature is similar to *.pth files (see site.py), except that it doesn't special-case lines starting with 'import'. A *.pkg file is trusted at face value: apart from checking for duplicates, all entries found in a *.pkg file are added to the path, regardless of whether they are exist the filesystem. (This is a feature.) If the input path is not a list (as is the case for frozen packages) it is returned unchanged. The input path is not modified; an extended copy is returned. Items are only appended to the copy at the end. It is assumed that sys.path is a sequence. Items of sys.path that are not (unicode or 8-bit) strings referring to existing directories are ignored. Unicode items of sys.path that cause errors when used as filenames may cause this function to raise an exception (in line with os.path.isdir() behavior). z.pkgNr-���r���r���zCan't open %s: %s � �#)r:����listr����r3���r4���r)���r����r���r5���r;���r���rA���r����submodule_search_locationsr����appendrF���rM����isfilero���rJ����stderr�write�rstripr����)r5���r���Z sname_pkgZparent_package�_Z final_nameZsearch_path�dirr����portionsr����ZportionZpkgfiler����r�����liner���r���r���r������sR����! � c�����������������C���s����t�j�|��}|dkrdS�|j}|dks0t|d�s4dS�tj�|��pJt�j� |�}|dks^t|d�sbdS�|� d�}|�dtj �|j���tj j|��}|�|�S�)af��Get a resource from a package. This is a wrapper round the PEP 302 loader get_data API. The package argument should be the name of a package, in standard module format (foo.bar). The resource argument should be in the form of a relative filename, using '/' as the path separator. The parent directory name '..' is not allowed, and nor is a rooted name (starting with a '/'). The function returns a binary string, which is the contents of the specified resource. For packages located in the filesystem, which have already been imported, this is the rough equivalent of d = os.path.dirname(sys.modules[package].__file__) data = open(os.path.join(d, resource), 'rb').read() If the package cannot be located or loaded, or it uses a PEP 302 loader which does not support get_data(), then None is returned. Nr����__file__�/r���)r���r���r���r���rA���r3���r4����get� _bootstrap�_loadr`����insertrF���r5����dirnamer����rM���r���)�package�resourcer����r���rm����partsZ resource_namer���r���r���r���V��s���� � )Nr%���N)Nr%���)r%���)r%���)r%���)r%���)'ri����collectionsr���� functoolsr���Z simplegenericr����importlib.util�importlib.machineryrF���Zos.pathr3����typesr���rV����__all__r���r���r���r ���r ���r>���rS����register� machinery� FileFinderr[���r���r ���r����r����r����r0���r���r���r���r���r���r���r���r���r���r����<module>���sh������������ 9 (��Jc ^