Ë
    Ï.f«"  ã                   óf   — 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 dZ G d„ d	e«      Zy)
é    N)Úpartial)Ú	urlencode)ÚDEFAULT_SENTINELÚGeocoder)ÚLocation)Úlogger)ÚPhotonc                   ót   ‡ — e Zd ZdZdZdZdeeddeddœˆ fd„
Zdedd	dddd
œd„Zded	ddœd„Z	dd„Z
d„ Zˆ xZS )r	   aÁ  Geocoder using Photon geocoding service (data based on OpenStreetMap
    and service provided by Komoot on https://photon.komoot.io).

    Documentation at:
        https://github.com/komoot/photon

    Photon/Komoot geocoder aims to let you `search as you type with
    OpenStreetMap`. No API Key is needed by this platform.

    .. versionchanged:: 2.2
        Changed default domain from ``photon.komoot.de``
        to ``photon.komoot.io``.
    z/apiz/reverseNzphoton.komoot.io)ÚschemeÚtimeoutÚproxiesÚdomainÚ
user_agentÚssl_contextÚadapter_factoryc                ó  •— t         ‰| �  ||||||¬«       |j                  d«      | _        | j                  ›d| j                  ›| j
                  ›�| _        | j                  ›d| j                  ›| j                  ›�| _        y)ap  

        :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 domain: Should be the localized Photon domain to
            connect to. The default is ``'photon.komoot.io'``, but you
            can change it to a domain of your own.

        :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__Ústripr   r   Úgeocode_pathÚapiÚreverse_pathÚreverse_api)	Úselfr   r   r   r   r   r   r   Ú	__class__s	           €úUC:\Users\user\Documents\project_loop\venv\Lib\site-packages\geopy/geocoders/photon.pyr   zPhoton.__init__   su   ø€ ôL 	‰ÑØØØØ!Ø#Ø+ð 	ô 	
ð —l‘l 3Ó'ˆŒØ"&§+£+¨t¯{ª{¸D×<MÒ<MÐNˆŒØ*.¯+«+°t·{²{ÀD×DUÒDUÐVˆÕó    TF)Úexactly_oner   Úlocation_biasÚlanguageÚlimitÚosm_tagÚbboxc                ó¬  — d|i}	|rt        |«      |	d<   |rd|	d<   |r||	d<   |r.	 | j                  |«      j                  d«      \  }
}||	d<   |
|	d<   |r| j	                  |d	«      |	d
<   |rTt        |t        «      r|g|	d<   n=t        |t        j                  j                  «      st        d«      ‚t        |«      |	d<   dj                  | j                  t        |	d¬«      f«      }t        j                  d| j                   j"                  |«       t%        | j&                  |¬«      }| j)                  |||¬«      S # t        $ r t        d«      ‚w xY w)aª  
        Return a location point by address.

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

        :param bool exactly_one: Return one result or a list of results, if
            available.

        :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.

        :param location_bias: The coordinates to use as location bias.
        :type location_bias: :class:`geopy.point.Point`, list or tuple of
            ``(latitude, longitude)``, or string
            as ``"%(latitude)s, %(longitude)s"``.

        :param str language: Preferred language in which to return results.

        :param int limit: Limit the number of returned results, defaults to no
            limit.

        :param osm_tag: The expression to filter (include/exclude) by key and/
            or value, str as ``'key:value'`` or list/set of str if multiple
            filters are required as ``['key:!val', '!key', ':!value']``.
        :type osm_tag: str or list or set

        :param bbox: The bounding box of the viewport within which
            to bias geocode results more prominently.
            Example: ``[Point(22, 180), Point(-22, -180)]``.

            .. versionadded:: 2.2
        :type bbox: list or tuple of 2 items of :class:`geopy.point.Point` or
            ``(latitude, longitude)`` or ``"%(latitude)s, %(longitude)s"``.

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

        Úqr"   é   Úlangú,ÚlonÚlatz0Location bias must be a coordinate pair or Pointz#%(lon1)s,%(lat1)s,%(lon2)s,%(lat2)sr$   r#   z2osm_tag must be a string or an iterable of stringsú?T)Údoseqz%s.geocode: %s©r   ©r   )ÚintÚ_coerce_point_to_stringÚsplitÚ
ValueErrorÚ_format_bounding_boxÚ
isinstanceÚstrÚcollectionsÚabcÚIterableÚlistÚjoinr   r   r   Údebugr   Ú__name__r   Ú_parse_jsonÚ_call_geocoder)r   Úqueryr   r   r    r!   r"   r#   r$   Úparamsr+   r*   ÚurlÚcallbacks                 r   ÚgeocodezPhoton.geocodeP   sg  € ðj �ð
ˆñ Ü! %›jˆF�7‰OÙØˆF�7‰OÙØ%ˆF�6‰NÙðUØ×7Ñ7¸ÓF×LÑLÈSÓQ‘��SØ #��u‘Ø #��u‘ñ Ø!×6Ñ6ØÐ;ó=ˆF�6‰Nñ Ü˜'¤3Ô'Ø%, I��yÒ!ä! '¬;¯?©?×+CÑ+CÔDÜ$ð1óð ô %)¨£M��yÑ!Ø�h‰h˜Ÿ™¤)¨F¸$Ô"?Ð@ÓAˆÜ�‰Ð% t§~¡~×'>Ñ'>ÀÔDÜ˜4×+Ñ+¸ÔEˆØ×"Ñ" 3¨¸'Ð"ÓBÐBøô) ò UÜ Ð!SÓTÐTðUús   ¦-D> Ä>E)r   r   r!   r"   c                ó¸  — 	 | j                  |«      j                  d«      \  }}||dœ}|rt        |«      |d<   |rd|d<   |r||d<   dj	                  | j
                  t        |«      f«      }	t        j                  d| j                  j                  |	«       t        | j                  |¬	«      }
| j                  |	|
|¬
«      S # t        $ r t        d«      ‚w xY w)aü  
        Return an address by location point.

        :param query: The coordinates for which you wish to obtain the
            closest human-readable addresses.
        :type query: :class:`geopy.point.Point`, list or tuple of ``(latitude,
            longitude)``, or string as ``"%(latitude)s, %(longitude)s"``.

        :param bool exactly_one: Return one result or a list of results, if
            available.

        :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.

        :param str language: Preferred language in which to return results.

        :param int limit: Limit the number of returned results, defaults to no
            limit.

        :rtype: ``None``, :class:`geopy.location.Location` or a list of them, if
            ``exactly_one=False``.
        r)   z"Must be a coordinate pair or Point)r+   r*   r"   r'   r(   r,   z%s.reverse: %sr.   r/   )r1   r2   r3   r0   r;   r   r   r   r<   r   r=   r   r>   r?   )r   r@   r   r   r!   r"   r+   r*   rA   rB   rC   s              r   ÚreversezPhoton.reverse¨   sã   € ðB	CØ×3Ñ3°EÓ:×@Ñ@ÀÓE‰HˆC�ð Øñ
ˆñ Ü! %›jˆF�7‰OÙØˆF�7‰OÙØ%ˆF�6‰NØ�h‰h˜×(Ñ(¬)°FÓ*;Ð<Ó=ˆÜ�‰Ð% t§~¡~×'>Ñ'>ÀÔDÜ˜4×+Ñ+¸ÔEˆØ×"Ñ" 3¨¸'Ð"ÓBÐBøô ò 	CÜÐAÓBÐBð	Cús   ‚#C ÃCc                 ó    — t        |d   «      sy|r| j                  |d   d   «      S |d   D �cg c]  }| j                  |«      ‘Œ c}S c c}w )zS
        Parse display name, latitude, and longitude from a JSON response.
        ÚfeaturesNr   )ÚlenÚ_parse_resource)r   Ú	resourcesr   Úresources       r   r>   zPhoton._parse_jsonÜ   s`   € ô �9˜ZÑ(Ô)ØÙØ×'Ñ'¨	°*Ñ(=¸aÑ(@ÓAÐAð ! Ñ,ö.°x�D×(Ñ(¨Õ2ò .ð .ùò .s   °Ac                 ó  — g d¢}|D �cg c]*  }|d   j                  |«      r|d   j                  |«      ‘Œ, }}dj                  |«      }|d   d   d   }|d   d   d   }|r|rt        |«      }t        |«      }t        |||f|«      S c c}w )N)ÚnameÚhousenumberÚstreetÚpostcoderP   ÚcityÚstateÚcountryÚ
propertiesz, ÚgeometryÚcoordinatesr'   r   )Úgetr;   Úfloatr   )r   rL   Úname_elementsÚkrN   ÚlocationÚlatitudeÚ	longitudes           r   rJ   zPhoton._parse_resourceè   s´   € ò-ˆð !öC°!Ø$,¨\Ñ$:×$>Ñ$>¸qÔ$Að ˜Ñ&×*Ñ*¨1Õ-ð Cˆð Cà—9‘9˜T“?ˆà˜JÑ'¨Ñ6°qÑ9ˆØ˜ZÑ(¨Ñ7¸Ñ:ˆ	Ù™	Ü˜X“ˆHÜ˜iÓ(ˆIä˜ 8¨YÐ"7¸ÓBÐBùòCs   ‰/B
)T)r=   Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   rD   rF   r>   rJ   Ú__classcell__)r   s   @r   r	   r	      sq   ø„ ñð €LØ€Lð
 Ø$Ø$Ø%ØØ(Ø ö0Wðl Ø$ØØØØØôVCðx Ø$ØØô2Cóh
.öCr   r	   )Úcollections.abcr7   Ú	functoolsr   Úurllib.parser   Úgeopy.geocoders.baser   r   Úgeopy.locationr   Ú
geopy.utilr   Ú__all__r	   © r   r   ú<module>rk      s,   ðÛ Ý Ý "ç ;Ý #Ý à
€ôkCˆXõ kCr   