관리-도구
편집 파일: importer.cpython-37.pyc
B d�UZ � @ s� d Z ddlZddlZddlZddlmZ ddlmZmZm Z m Z e�e�Z yejjZW n ek rr dd� ZY nX G dd� de�Zd d d �Zdd� ZdS )a: Implements an importer that looks only in specific path (ignoring sys.path), and uses a per-path cache in addition to sys.modules. This is necessary because test modules in different directories frequently have the same names, which means that the first loaded would mask the rest when using the builtin importer. � N)�Config)�find_module�load_module�acquire_lock�release_lockc C s( t j�t j�| ��t j�t j�|��kS )N)�os�path�normcase�realpath)�src�dst� r �>/opt/alt/python37/lib/python3.7/site-packages/nose/importer.py� _samefile s r c @ s: e Zd ZdZd dd�Zdd� Zdd� Zd d � Zdd� ZdS )�Importerz�An importer class that does only path-specific imports. That is, the given module is not searched for on sys.path, but only at the path or in the directory specified. Nc C s |d krt � }|| _d S )N)r �config)�selfr r r r �__init__ s zImporter.__init__c C sd t j�t j�|���t j�}|�d�}|d dkr:|�� |dt|� � }t j�|�}| � ||�S )z�Import a dotted-name package whose tail is at path. In other words, given foo.bar and path/to/foo/bar.py, import foo from path/to/foo then bar from path/to/foo/bar, returning bar. �.���z__init__.pyN) r r �normpath�abspath�split�sep�pop�len�join� importFromDir)r r �fqname� path_partsZ name_partsZdir_pathr r r �importFromPath"