U
    ꥡc'                     @   s(   d Z ddlZddlZdZdadd ZdS )a?  
Resolve a name to an object.

It is expected that `name` will be a string in one of the following
formats, where W is shorthand for a valid Python identifier and dot stands
for a literal period in these pseudo-regexes:

W(.W)*
W(.W)*:(W(.W)*)?

The first form is intended for backward compatibility only. It assumes that
some part of the dotted name is a package, and the rest is an object
somewhere within that package, possibly nested inside other objects.
Because the place where the package stops and the object hierarchy starts
can't be inferred by inspection, repeated attempts to import must be done
with this form.

In the second form, the caller makes the division point clear through the
provision of a single colon: the dotted name to the left of the colon is a
package to be imported, and the dotted name to the right is the object
hierarchy within that package. Only one import is needed in this form. If
it ends with the colon, then a module object is returned.

The function will return an object (which might be a module), or raise one
of the following exceptions:

ValueError - if `name` isn't in a recognised format
ImportError - if an import failed when it shouldn't have
AttributeError - if a failure occurred when traversing the object hierarchy
                 within the imported package to get to the desired object)
    Nz1.3.10c                 C   s  t dkr0ddl}d}|d| d| d|ja t | }|sLtd| | }|drt	|d	 }|d
}|r|
dng }np| 
d}|d}t	|}|r|d }| d| }	zt	|	}|d |	}W q tk
r   Y qY qX q|}
|D ]}t|
|}
q|
S )a  
    Resolve a name to an object.

    It is expected that `name` will be a string in one of the following
    formats, where W is shorthand for a valid Python identifier and dot stands
    for a literal period in these pseudo-regexes:

    W(.W)*
    W(.W)*:(W(.W)*)?

    The first form is intended for backward compatibility only. It assumes that
    some part of the dotted name is a package, and the rest is an object
    somewhere within that package, possibly nested inside other objects.
    Because the place where the package stops and the object hierarchy starts
    can't be inferred by inspection, repeated attempts to import must be done
    with this form.

    In the second form, the caller makes the division point clear through the
    provision of a single colon: the dotted name to the left of the colon is a
    package to be imported, and the dotted name to the right is the object
    hierarchy within that package. Only one import is needed in this form. If
    it ends with the colon, then a module object is returned.

    The function will return an object (which might be a module), or raise one
    of the following exceptions:

    ValueError - if `name` isn't in a recognised format
    ImportError - if an import failed when it shouldn't have
    AttributeError - if a failure occurred when traversing the object hierarchy
                     within the imported package to get to the desired object)
    Nr   z(?!\d)(\w+)(\.(?!\d)(\w+))*z	^(?P<pkg>z)(?P<cln>:(?P<obj>z)?)?$zinvalid format: Zclnpkgobj.)_NAME_PATTERNrecompileUNICODEmatch
ValueError	groupdictget	importlibimport_modulesplitpopImportErrorgetattr)namer   Zdotted_wordsmgdmodpartsmodnamepsresult r   8/tmp/pip-unpacked-wheel-hnoqlx55/pkgutil_resolve_name.pyresolve_name)   s<    !







r   )__doc__r   r   __version__r   r   r   r   r   r   <module>   s
    