U
    be&                     @   s   d Z ddlZddlZddlZeeZdZeej	ia
i adadd Zdd Zeej	 ed	 ed
 ed ed ed ed ed ed eet
 adS )z~Maintains a registry of transport mechanisms.

The main entrypoint is :func:`get_transport`.  See also :file:`extending.md`.

    N zYou are trying to use the %(module)s functionality of smart_open
but you do not have the correct %(module)s dependencies installed. Try:

    pip install smart_open[%(module)s]

c                 C   s   | }t | tr6zt| } W q< tk
r2   Y dS X n| j}|dd }t| dr^| jg}nt| drp| j	}nt
d|  dD ]}t| |std| |f q|D ].}|tkstt| d	d
r|t|< q| t|< qdS )ai  Register a submodule as a transport mechanism for ``smart_open``.

    This module **must** have:

        - `SCHEME` attribute (or `SCHEMES`, if the submodule supports multiple schemes)
        - `open` function
        - `open_uri` function
        - `parse_uri' function

    Once registered, you can get the submodule by calling :func:`get_transport`.

    N.SCHEMESCHEMESz0%r does not have a .SCHEME or .SCHEMES attribute)openZopen_uri	parse_uriz%r is missing %rZMISSING_DEPSF)
isinstancestr	importlibimport_moduleImportError__name__rsplithasattrr   r   
ValueErrorAssertionError	_REGISTRYgetattr_ERRORS)	submodulemodule_nameschemesfscheme r   V/var/www/html/services/stratfitenv/lib/python3.8/site-packages/smart_open/transport.pyregister_transport    s(    





r   c                 C   sL   t }d}dt  }| tkr0tttt|  d | tkr@t|  S t|dS )zGet the submodule that handles transport for the specified scheme.

    This submodule must have been previously registered via :func:`register_transport`.

    zFhttps://github.com/RaRe-Technologies/smart_open/blob/master/README.rstzUnable to handle scheme %(scheme)r, expected one of %(expected)r. Extra dependencies required by %(scheme)r may be missing. See <%(readme_url)s> for details.)moduleN)SUPPORTED_SCHEMESlocalsr   r   _MISSING_DEPS_ERRORdictr   NotImplementedError)r   expectedZ
readme_urlmessager   r   r   get_transportK   s    r&   zsmart_open.azurezsmart_open.ftpzsmart_open.gcszsmart_open.hdfszsmart_open.httpzsmart_open.s3zsmart_open.sshzsmart_open.webhdfs)__doc__r   loggingZsmart_open.local_fileZ
smart_open	getLoggerr   loggerZ	NO_SCHEME
local_filer   r   r!   r   r&   tuplesortedkeysr   r   r   r   r   <module>   s*   

+
