
    .hu!                     f    S SK r S SKJr  S SKJr  S SKJrJr  S SKJ	r	  S SK
Jr  Sr " S S	\5      rg)
    N)partial)	urlencode)DEFAULT_SENTINELGeocoder)Location)logger)Peliasc                      ^  \ rS rSrSrSrSr S\\SS\SS.U 4S jjjrS\SSSSS	.S
 jr	S\SS.S jr
S rS rSrU =r$ )r	      zPelias geocoder.

Documentation at:
    https://github.com/pelias/documentation

See also :class:`geopy.geocoders.GeocodeEarth` which is a Pelias-based
service provided by the developers of Pelias itself.
z
/v1/searchz/v1/reverseN)timeoutproxies
user_agentschemessl_contextadapter_factoryc          	        > [         T	U ]  UUUUUUS9  X l        UR                  S5      U l        U R
                  < SU R                  < U R                  < 3U l        U R
                  < SU R                  < U R                  < 3U l	        g)a  
:param str domain: Specify a domain for Pelias API.

:param str api_key: Pelias API key, optional.

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

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

: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stripdomainr   geocode_pathgeocode_apireverse_pathreverse_api)
selfr   r   r   r   r   r   r   r   	__class__s
            iC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\geopy/geocoders/pelias.pyr   Pelias.__init__   s    R 	!#+ 	 	
 ll3'  ;;T5F5FG 	  ;;T5F5FG 	    T)exactly_oner   boundary_rect	countriescountry_biaslanguagec                ^   SU0nU R                   (       a  UR                  SU R                   05        U(       a4  U R                  US5      R                  S5      u  ppXS'   XS'   XS'   XS'   U(       a  [        R
                  " S	[        S
S9  XhS'   U(       a  SR                  U5      US'   U(       a  XxS'   SR                  U R                  [        U5      45      n[        R                  " SU R                  R                  U5        [        U R                  US9nU R!                  XUS9$ )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.

:type boundary_rect: list or tuple of 2 items of :class:`geopy.point.Point`
    or ``(latitude, longitude)`` or ``"%(latitude)s, %(longitude)s"``.
:param boundary_rect: Coordinates to restrict search within.
    Example: ``[Point(22, 180), Point(-22, -180)]``.

:param list countries: A list of country codes specified in
    `ISO 3166-1 alpha-2 or alpha-3
    <https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3>`_
    format, e.g. ``['USA', 'CAN']``.
    This is a hard filter.

    .. versionadded:: 2.3

:param str country_bias: Bias results to this country (ISO alpha-3).

    .. deprecated:: 2.3
        Use ``countries`` instead. This option behaves the same way,
        i.e. it's not a soft filter as the name suggests.
        This parameter is scheduled for removal in geopy 3.0.

:param str language: Preferred language in which to return results.
    Either uses standard
    `RFC2616 <http://www.ietf.org/rfc/rfc2616.txt>`_
    accept-language string or a simple comma-separated
    list of language codes.

:rtype: ``None``, :class:`geopy.location.Location` or a list of them, if
    ``exactly_one=False``.
textr   z#%(lon1)s,%(lat1)s,%(lon2)s,%(lat2)s,zboundary.rect.min_lonzboundary.rect.min_latzboundary.rect.max_lonzboundary.rect.max_latz`country_bias` is deprecated, because it's not a soft filter as the name suggests. Pass a list to the `countries` option instead, which behaves the same way. In geopy 3 the `country_bias` option will be removed.   )
stacklevelzboundary.countrylang?z%s.geocode_api: %sr"   r   )r   update_format_bounding_boxsplitwarningswarnDeprecationWarningjoinr   r   r   debugr   __name__r   _parse_json_call_geocoder)r   queryr"   r   r#   r$   r%   r&   paramslon1lat1lon2lat2urlcallbacks                  r   geocodePelias.geocodeU   s)   j %<<MM4<<  %)%>%>D&FFKeCj #D.2*+.2*+.2*+.2*+MMM # *6%&),))<F%&%6Nhh(()F*;<=)4>>+B+BCH4++E""3'"BBr!   )r"   r   r&   c                    U R                  U5      R                  S5      u  pVUUS.nU(       a  XGS'   U R                  (       a  UR	                  SU R                  05        SR                  U R                  [        U5      45      n[        R                  " SU R                  R                  U5        [        U R                  US9n	U R                  XUS	9$ ! [         a    [        S5      ef = f)
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.
    Either uses standard
    `RFC2616 <http://www.ietf.org/rfc/rfc2616.txt>`_
    accept-language string or a simple comma-separated
    list of language codes.

:rtype: ``None``, :class:`geopy.location.Location` or a list of them, if
    ``exactly_one=False``.
r)   z"Must be a coordinate pair or Point)z	point.latz	point.lonr,   r   r-   z%s.reverse: %sr.   r/   )_coerce_point_to_stringr2   
ValueErrorr   r0   r6   r   r   r   r7   r   r8   r   r9   r:   )
r   r;   r"   r   r&   latlonr<   rA   rB   s
             r   reversePelias.reverse   s    B	C33E:@@EHC 

 %6N<<MM4<<  hh(()F*;<=%t~~'>'>D4++E""3'"BB%  	CABB	Cs   "C C.c                     UR                  S0 5      R                  S/ 5      S   nUR                  S0 5      R                  S/ 5      S   nUR                  S0 5      R                  S5      n[        XBU4U5      $ )Ngeometrycoordinates   r   
propertiesname)getr   )r   featurelatitude	longitude	placenames        r   _parse_codePelias._parse_code   ss    ;;z2.22="EaHKK
B/33M2FqI	KKb155f=		i#8'BBr!   c                     Uc  g US   n[        U5      (       d  g U(       a  U R                  US   5      $ U Vs/ s H  o@R                  U5      PM     sn$ s  snf )Nfeaturesr   )lenrW   )r   responser"   rZ   rS   s        r   r9   Pelias._parse_json   sZ    J'8}}##HQK00=EFX'$$W-XFFFs   A)r   r   r   r   )N)r8   
__module____qualname____firstlineno____doc__r   r   r   r   rC   rJ   rW   r9   __static_attributes____classcell__)r   s   @r   r	   r	      s}      L L
 :

 %$( :
 :
@ $XC| $5CnC	G 	Gr!   r	   )r3   	functoolsr   urllib.parser   geopy.geocoders.baser   r   geopy.locationr   
geopy.utilr   __all__r	    r!   r   <module>rk      s,      " ; # 
jGX jGr!   