← Back
Editing: importstring.cpython-311.pyc
� ��X � � � d Z d� ZdS )z: A simple utility to import something by its string name. c � � | � dd� � }t |� � dk rK|\ }}t ||g�� � } t ||� � }n # t $ r t d|z � � �w xY w|S t |d � � S )a� Import and return ``bar`` given the string ``foo.bar``. Calling ``bar = import_item("foo.bar")`` is the functional equivalent of executing the code ``from foo import bar``. Parameters ---------- name : string The fully qualified name of the module/package being imported. Returns ------- mod : module object The module that was imported. �.� � )�fromlistzNo module named %s� )�rsplit�len� __import__�getattr�AttributeError�ImportError)�name�parts�package�obj�module�paks �?/usr/lib/python3/dist-packages/ipython_genutils/importstring.py�import_itemr s� � �"