a
    =Df                     @  s   d Z ddlmZ ddlZeeZddlZddlZddl	Z	ddl
mZ ddlmZ G dd dejZed	Ze e_ d
e_eejd	< [[[dS )a@   Pre-configured tile sources for common third party tile services.

.. autofunction:: bokeh.tile_providers.get_provider

The available built-in tile providers are listed in the ``Vendors`` enum:

.. bokeh-enum:: Vendors
    :module: bokeh.tile_providers
    :noindex:

.. warning::
    The built-in Vendors are deprecated as of Bokeh 3.0.0 and will be removed in a future
    release. You can pass the same strings to ``add_tile`` directly.

Any of these values may be be passed to the ``get_provider`` function in order
to obtain a tile provider to use with a Bokeh plot. Representative samples of
each tile provider are shown below.

CARTODBPOSITRON
---------------

Tile Source for CartoDB Tile Service

.. raw:: html

    <img src="https://tiles.basemaps.cartocdn.com/light_all/14/2627/6331.png" />

CARTODBPOSITRON_RETINA
----------------------

Tile Source for CartoDB Tile Service (tiles at 'retina' resolution)

.. raw:: html

    <img src="https://tiles.basemaps.cartocdn.com/light_all/14/2627/6331@2x.png" />

ESRI_IMAGERY
------------

Tile Source for ESRI public tiles.

.. raw:: html

    <img src="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/14/6331/2627.jpg" />

OSM
---

Tile Source for Open Street Maps.

.. raw:: html

    <img src="https://c.tile.openstreetmap.org/14/2627/6331.png" />

    )annotationsN)enumeration   )
deprecatedc                   @  s^   e Zd Zdd Ze ZddddZejZejZejZej	Z	ej
Z
ejZejZejZejZdS )_TileProvidersModulec                   C  s(   t ddd tdddddd	d
dddd
S )N   r   r   ztile_providers moduleadd_tile directlyCARTODBPOSITRONCARTODBPOSITRON_RETINASTAMEN_TERRAINSTAMEN_TERRAIN_RETINASTAMEN_TONERSTAMEN_TONER_BACKGROUNDSTAMEN_TONER_LABELSOSMESRI_IMAGERYT)Zcase_sensitive)r   r    r   r   a/nfs/NAS7/SABIOD/METHODE/ermites/ermites_venv/lib/python3.9/site-packages/bokeh/tile_providers.pydeprecated_vendorsm   s    z'_TileProvidersModule.deprecated_vendorsz(str | Vendors | xyzservices.TileProvider)provider_namec                 C  s   t ddd ddlm} t||r2||j|jdS t|tr| }|dkrPd}|d	kr\d
}|drpd| }d|v r|	dd}d}nd}|rdnd}t
j|}nd}t|t
jr||j|d|j|dd|dddS dS )aF  Use this function to retrieve an instance of a predefined tile provider.

        .. warning::
            get_provider is deprecated as of Bokeh 3.0.0 and will be removed in a future
            release. Use ``add_tile`` directly instead.

        Args:
            provider_name (Union[str, Vendors, xyzservices.TileProvider]):
                Name of the tile provider to supply.

                Use a ``tile_providers.Vendors`` enumeration value, or the string
                name of one of the known providers. Use
                :class:`xyzservices.TileProvider` to pass custom tile providers.

        Returns:
            WMTSTileProviderSource: The desired tile provider instance.

        Raises:
            ValueError: if the specified provider can not be found.

        Example:

            .. code-block:: python

                    >>> from bokeh.tile_providers import get_provider, Vendors
                    >>> get_provider(Vendors.CARTODBPOSITRON)
                    <class 'bokeh.models.tiles.WMTSTileSource'>
                    >>> get_provider('CARTODBPOSITRON')
                    <class 'bokeh.models.tiles.WMTSTileSource'>

                    >>> import xyzservices.providers as xyz
                    >>> get_provider(xyz.CartoDB.Positron)
                    <class 'bokeh.models.tiles.WMTSTileSource'>
        r   get_providerr	   r   )WMTSTileSource)urlattributionZesri_imageryZesri_worldimageryZosmZopenstreetmap_mapnikZstamenzstadia.retina TFz@2xN)scale_factormin_zoommax_zoom   )r   r   r   r   )r   Zbokeh.modelsr   
isinstancer   r   strlower
startswithreplacexyzservices	providersZ
query_nameZTileProviderZ	build_urlZhtml_attributionget)selfr   r   r   r   r   r   r   r   w   s4    #






z!_TileProvidersModule.get_providerN)__name__
__module____qualname__r   Vendorsr   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   k   s   Ir   zbokeh.tile_providers)r
   r   r   r   r   r   r   r   r   r   r-   )__doc__
__future__r   logging	getLoggerr*   logsystypesr&   Zbokeh.core.enumsr   Zutil.deprecationr   
ModuleTyper   Z_mod__all__modulesr   r   r   r   <module>   s   ;
c
