U
    -e                     @   s$   d Z ddlmZ eedddZdS )z:
A simple utility to import something by its string name.
    )Any)namereturnc              
   C   s   t | tstdt|  | dd}t|dkr|\}}t||gd}zt||}W n0 tk
r } zt	d| |W 5 d}~X Y nX |S t|d S 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.
    z&import_item accepts strings, not '%s'..      )fromlistzNo module named %sNr   )

isinstancestr	TypeErrortypersplitlen
__import__getattrAttributeErrorImportError)r   partspackageobjmoduleZpake r   ]/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/traitlets/utils/importstring.pyimport_item	   s    
 r   N)__doc__typingr   r
   r   r   r   r   r   <module>   s   