Ë
    Ï.fÂ  ã                   ój   — d dl Zd dlmZ d dlmZ d dlmZmZ d dl	m
Z
 d dlmZmZ dZ G d„ d	e«      Zy)
é    N)Úpartial)Ú	urlencode)ÚDEFAULT_SENTINELÚGeocoder)ÚLocation)Újoin_filterÚlogger)ÚGeolakec                   ó\   ‡ — e Zd ZdZh d£ZdZddeededdœˆ fd„
Zdded	œd
„Zd„ Z	d„ Z
ˆ xZS )r
   z£Geocoder using the Geolake API.

    Documentation at:
        https://geolake.com/docs/api

    Terms of Service at:
        https://geolake.com/terms-of-use
    >   ÚcityÚstateÚstreetÚaddressÚcountryÚzipcodeÚ	subNumberÚhouseNumberz/v1/geocodezapi.geolake.comN)ÚdomainÚschemeÚtimeoutÚproxiesÚ
user_agentÚssl_contextÚadapter_factoryc                óÂ   •— t         ‰	| �  ||||||¬«       || _        |j                  d«      | _        | j
                  ›d| j                  ›| j                  ›�| _        y)aÊ  

        :param str api_key: The API key required by Geolake
            to perform geocoding requests. You can get your key here:
            https://geolake.com/

        :param str domain: Currently it is ``'api.geolake.com'``, can
            be changed for testing purposes.

        :param str scheme:
            See :attr:`geopy.geocoders.options.default_scheme`.

        :param int timeout:
            See :attr:`geopy.geocoders.options.default_timeout`.

        :param dict proxies:
            See :attr:`geopy.geocoders.options.default_proxies`.

        :param str user_agent:
            See :attr:`geopy.geocoders.options.default_user_agent`.

        :type ssl_context: :class:`ssl.SSLContext`
        :param ssl_context:
            See :attr:`geopy.geocoders.options.default_ssl_context`.

        :param callable adapter_factory:
            See :attr:`geopy.geocoders.options.default_adapter_factory`.

            .. versionadded:: 2.0

        )r   r   r   r   r   r   ú/z://N)ÚsuperÚ__init__Úapi_keyÚstripr   r   Úapi_pathÚapi)
Úselfr   r   r   r   r   r   r   r   Ú	__class__s
            €úVC:\Users\user\Documents\project_loop\venv\Lib\site-packages\geopy/geocoders/geolake.pyr   zGeolake.__init__#   s]   ø€ ôV 	‰ÑØØØØ!Ø#Ø+ð 	ô 	
ð ˆŒØ—l‘l 3Ó'ˆŒØ"&§+£+¨t¯{ª{¸D¿MºMÐJˆ�ó    T)Úcountry_codesÚexactly_oner   c                óH  — t        |t        j                  j                  «      rA|j	                  «       D ��ci c]  \  }}|| j
                  v r||“Œ }}}| j                  |d<   n| j                  |dœ}|sg }t        |t        «      r|g}|rdj                  |«      |d<   dj                  | j                  t        |«      f«      }t        j                  d| j                  j                  |«       t        | j                   |¬«      }	| j#                  ||	|¬«      S c c}}w )	aû  
        Return a location point by address.

        :param query: The address or query you wish to geocode.

            For a structured query, provide a dictionary whose keys
            are one of: `country`, `state`, `city`, `zipcode`, `street`, `address`,
            `houseNumber` or `subNumber`.
        :type query: str or dict

        :param country_codes: Provides the geocoder with a list
            of country codes that the query may reside in. This value will
            limit the geocoder to the supplied countries. The country code
            is a 2 character code as defined by the ISO-3166-1 alpha-2
            standard (e.g. ``FR``). Multiple countries can be specified with
            a Python list.

        :type country_codes: str or list

        :param bool exactly_one: Return one result or a list of one result.

        :param int timeout: Time, in seconds, to wait for the geocoding service
            to respond before raising a :class:`geopy.exc.GeocoderTimedOut`
            exception. Set this only if you wish to override, on this call
            only, the value set during the geocoder's initialization.

        :rtype: ``None``, :class:`geopy.location.Location` or a list of them, if
            ``exactly_one=False``.

        r   )r   Úqú,ÚcountryCodesú?z%s.geocode: %s)r(   )r   )Ú
isinstanceÚcollectionsÚabcÚMappingÚitemsÚstructured_query_paramsr   ÚstrÚjoinr"   r   r	   Údebugr$   Ú__name__r   Ú_parse_jsonÚ_call_geocoder)
r#   Úqueryr'   r(   r   ÚkeyÚvalÚparamsÚurlÚcallbacks
             r%   ÚgeocodezGeolake.geocode[   s  € ôN �eœ[Ÿ_™_×4Ñ4Ô5ð —;‘;“=÷á�C˜à˜$×6Ñ6Ñ6ð �S‘ðˆFñ ð !%§¡ˆF�9Òð  Ÿ<™<ØñˆFñ
 ØˆMÜ�m¤SÔ)Ø*˜OˆMÙØ%(§X¡X¨mÓ%<ˆF�>Ñ"à�h‰h˜Ÿ™¤)¨FÓ"3Ð4Ó5ˆä�‰Ð% t§~¡~×'>Ñ'>ÀÔDÜ˜4×+Ñ+¸ÔEˆØ×"Ñ" 3¨¸'Ð"ÓBÐBùó1s   ¸Dc                 óˆ   — |j                  d«      sy|d   }|d   }| j                  |«      }t        |||f|«      }|r|S |gS )z7Returns location, (latitude, longitude) from json feed.ÚsuccessNÚlatitudeÚ	longitude)ÚgetÚ_get_addressr   )r#   Úpager(   rC   rD   r   Úresults          r%   r8   zGeolake._parse_json�   sY   € ð �x‰x˜	Ô"Øà˜
Ñ#ˆØ˜Ñ%ˆ	à×#Ñ# DÓ)ˆÜ˜' H¨iÐ#8¸$Ó?ˆÙØˆMà�8ˆOr&   c                 óˆ   — |j                  d«      }|j                  d«      }|j                  d«      }t        d||g«      }|S )zl
        Returns address string from page dictionary
        :param page: dict
        :return: str
        Úplacer   ÚcountryCodez, )rE   r   )r#   rG   rJ   Úaddress_cityÚaddress_country_coder   s         r%   rF   zGeolake._get_address­   sF   € ð —‘˜Ó!ˆØ—y‘y Ó(ˆØ$Ÿy™y¨Ó7ÐÜ˜d \Ð3GÐ$HÓIˆØˆr&   )r7   Ú
__module__Ú__qualname__Ú__doc__r3   r!   r   r   r@   r8   rF   Ú__classcell__)r$   s   @r%   r
   r
      sR   ø„ ñò	Ðð €Hð %ØØ$Ø$ØØ(Ø ö6Kðx ØØ$ô@CòDö 
r&   r
   )Úcollections.abcr/   Ú	functoolsr   Úurllib.parser   Úgeopy.geocoders.baser   r   Úgeopy.locationr   Ú
geopy.utilr   r	   Ú__all__r
   © r&   r%   ú<module>rZ      s*   ðÛ Ý Ý "ç ;Ý #ß *à
€ôkˆhõ kr&   