Hacked By AnonymousFox
U
e5d7, � @ s, d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm
Z
dd lmZ dd
lmZ ddlm
Z
ddlmZ d
dlmZ d
dlZd
dlZd
dlZd
dlZd
dlZdd� Zdd� Zd$dd�Zd%dd�Zedd� �Zdd� Zdd� Zdd� ZG d d!� d!ej�ZG d"d#� d#ej �Z!dS )&z-Utility code for constructing importers, etc.� )�abc)�module_from_spec)�
_resolve_name)�spec_from_loader)�
_find_spec)�MAGIC_NUMBER)�_RAW_MAGIC_NUMBER)�cache_from_source)�
decode_source)�source_from_cache)�spec_from_file_location� )�contextmanagerNc C s t �t| �S )zBReturn the hash of *source_bytes* as used in hash-based pyc files.)�_imp�source_hashr )�source_bytes� r �&/usr/lib64/python3.8/importlib/util.pyr s r c C s\ | � d�s| S |s&tdt| �� d���d}| D ]}|dkr> qH|d7 }q.t| |d� ||�S )z2Resolve a relative module name to an absolute one.�.zno package specified for z% (required for relative module names)r
r N)�
startswith�
ValueError�reprr )�name�package�level� characterr r r �resolve_name s
r c C sx | t jkrt| |�S t j| }|dkr*dS z
|j}W n$ tk
rX td�| ��d�Y nX |dkrptd�| ���|S dS )a� Return the spec for the specified module.
First, sys.modules is checked to see if the module was already imported. If
so, then sys.modules[name].__spec__ is returned. If that happens to be
set to None, then ValueError is raised. If the module is not in
sys.modules, then sys.meta_path is searched for a suitable spec with the
value of 'path' given to the finders. None is returned if no spec could
be found.
Dotted names do not have their parent packages implicitly imported. You will
most likely need to explicitly import all parent packages in the proper
order for a submodule to get the correct spec.
N�{}.__spec__ is not set�{}.__spec__ is None)�sys�modulesr �__spec__�AttributeErrorr �format)r �path�module�specr r r �_find_spec_from_path* s
r'