importstring.pyc
1 o 2 ��cs � @ s d Z dd� ZdS )z: 3 A simple utility to import something by its string name. 4 c 5 C s� t | t�s tdt| � ��| �dd�}t|�dkr@|\}}t||gd�}zt||�}W |S ty? } zt d| �|�d}~ww t|d �S ) a� Import and return ``bar`` given the string ``foo.bar``. 6 7 Calling ``bar = import_item("foo.bar")`` is the functional equivalent of 8 executing the code ``from foo import bar``. 9 10 Parameters 11 ---------- 12 name : string 13 The fully qualified name of the module/package being imported. 14 15 Returns 16 ------- 17 mod : module object 18 The module that was imported. 19 z&import_item accepts strings, not '%s'.�.� � )�fromlistzNo module named %sN� ) 20 � 21 isinstance�str� TypeError�type�rsplit�len� 22 __import__�getattr�AttributeError�ImportError)�name�parts�package�obj�module�pak�e� r ��C:\Users\Jacks.GUTTSPC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\traitlets\utils\importstring.py�import_item s 23 ���r N)�__doc__r r r r r �<module> s