U
    SZf`                     @   s   d dl Z dddZdS )    N c                    sR   dd |D dd |D fdd}t t    fdd} ||fS )a  
    Helper function to import submodules lazily in Python 3.7+

    Parameters
    ----------
    rel_modules: list of str
        list of submodules to import, of the form .submodule
    rel_classes: list of str
        list of submodule classes/variables to import, of the form ._submodule.Foo

    Returns
    -------
    tuple
        Tuple that should be assigned to __all__, __getattr__ in the caller
    c                 S   s   i | ]}| d d |qS .split).0
rel_moduler   r   ;/tmp/pip-unpacked-wheel-5ksk5baj/_plotly_utils/importers.py
<dictcomp>   s      z#relative_import.<locals>.<dictcomp>c                 S   s   i | ]}| d d |qS r   r   )r   rel_pathr   r   r
   r      s      c                    st   | kr|  }t |S |  kr^ |  d}d|d d }| }t |}t||S tdj| dd S )Nr   r   z-module {__name__!r} has no attribute {name!r})name__name__)	importlibimport_moduler   joingetattrAttributeErrorformat)import_nameZ
rel_importZrel_path_partsr	   
class_nameZclass_module)class_namesmodule_namesparent_namer   r
   __getattr__   s    
 z$relative_import.<locals>.__getattr__c                      s    S )Nr   r   )__all__r   r
   __dir__/   s    z relative_import.<locals>.__dir__)list)r   Zrel_modulesZrel_classesr   r   r   )r   r   r   r   r
   relative_import   s    r   )r   r   )r   r   r   r   r   r
   <module>   s   