
    .h                          S r  SSKJrJr  SSKJr  SrSSKJ	r	J
r
  SSKJr  SSKJr  SS	KJrJr  S
r " S S\	5      rg! \ a    Sr N4f = f)z&
:class:`.YahooPlaceFinder` geocoder.
    )getRequest)OAuth1FT)GeocoderDEFAULT_TIMEOUT)GeocoderParseError)Location)string_compare	text_type)YahooPlaceFinderc                   |   ^  \ rS rSrSr\SS4U 4S jjr\S 5       rS r	\S 5       r
      SS jrSS	 jrS
rU =r$ )r      zz
Geocoder that utilizes the Yahoo! BOSS PlaceFinder API. Documentation at:
    https://developer.yahoo.com/boss/geo/docs/
Nc                    > [         (       a  [        S5      e[        [        U ]  X4US9  [        U5      U l        [        U5      U l        [        U R                  U R                  SSS9U l	        SU l
        g)ah  
:param str consumer_key: Key provided by Yahoo.

:param str consumer_secret: Secret corresponding to the key
    provided by Yahoo.

:param int timeout: Time, in seconds, to wait for the geocoding service
    to respond before raising a :class:`geopy.exc.GeocoderTimedOut`
    exception.

:param dict proxies: If specified, routes this geocoder"s requests
    through the specified proxy. E.g., {"https": "192.0.2.0"}. For
    more information, see documentation on
    :class:`urllib2.ProxyHandler`.

    .. versionadded:: 0.96

:param str user_agent: Use a custom User-Agent header.

    .. versionadded:: 1.12.0
zgrequests-oauthlib is needed for YahooPlaceFinder. Install with `pip install geopy -e ".[placefinder]"`.)timeoutproxies
user_agentz	HMAC-SHA1AUTH_HEADER)
client_keyclient_secretsignature_methodsignature_typez+https://yboss.yahooapis.com/geo/placefinderN)requests_missingImportErrorsuperr   __init__r   consumer_keyconsumer_secretr   authapi)selfr   r   r   r   r   	__class__s         nC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\geopy/geocoders/placefinder.pyr   YahooPlaceFinder.__init__   s    : I  	. 	/ 	
 &l3(9((..((	
	 A    c                     U(       a0  U  Vs/ s H#  n[        UR                  S   5      U:  d  M!  UPM%     n nU(       a'  U  Vs/ s H  nUR                  S   U;   d  M  UPM     n nU $ s  snf s  snf )zi
Returns only the results that meet the minimum quality threshold
and are located in expected countries.
qualitycountrycode)intraw)resultsmin_qualityvalid_country_codeslocs       r"   _filtered_results"YahooPlaceFinder._filtered_resultsI   s      #"Cswwy)*[8 "    #"C77=)-@@ "   s    A(A(A-A-c                 P    US   S   n[        U5      (       a   [        UR                  S/ 5      5      (       d  gUS    Vs/ s H7  n[        U R                  U5      [	        US   5      [	        US   5      4US9PM9     nnU$ s  snf ! [
        [        4 a    [        S5      ef = f)	z6
Returns the parsed result of a PlaceFinder API call.
bossresponseplacefinderr*   Nlatitude	longitude)r)   z Error parsing PlaceFinder result)lenr   r	   humanizefloatKeyError
ValueErrorr   )r    contentr2   placer*   s        r"   _parse_response YahooPlaceFinder._parse_response_   s    	I'6  {##3{y"/M+N+N )3 4E MM%(5,-uU;5G/HI
 4    *% 	I$%GHH	Is"   8B	 B	 >B B	 B	 	B%c                 j    SR                  S Vs/ s H  nX   (       d  M  X   PM     sn5      $ s  snf )zG
Returns a human readable representation of a raw PlaceFinder location
z, )line1line2line3line4)join)locationlines     r"   r6   YahooPlaceFinder.humanizev   s>    
 yy<
<~ HN<
  	 
s   00c                 &   USS.nU(       a  SUS'   U(       a  SUS'   U(       a  US==   S-  ss'   U R                  U R                  U[        UU R                  S	9n	U R	                  U	5      n
U
c  g
U R                  U
UU5      n
U(       a  U
S   $ U
$ )a  
Geocode a location query.

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

:param bool reverse:

:param valid_country_codes:
:type valid_country_codes: list or tuple

:param bool with_timezone: Include the timezone in the response's
    `raw` dictionary (as `timezone`).
J)rD   flagsRgflags1countrI   T)r   	requesterparamsr   Nr   )_call_geocoderr   r   r   r<   r.   )r    queryexactly_oner   r+   reverser,   with_timezonerP   responser*   s              r"   geocodeYahooPlaceFinder.geocode   s    : 

 "F8!F7O7Os"O&&HH ' 
 &&x0?((
 1:Nr$   c                     U R                  U5      n[        U[        5      (       a  UR                  SS5      nU R	                  UUUSS9$ )a~  
Returns a reverse geocoded location using Yahoo"s PlaceFinder API.

: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.
  T)rS   r   rT   )_coerce_point_to_string
isinstancer
   replacerW   )r    rR   rS   r   s       r"   rT   YahooPlaceFinder.reverse   sS     ,,U3e^,,MM#r*E||#	  
 	
r$   )r   r   r   r   )TNr   FNF)TN)__name__
__module____qualname____firstlineno____doc__r   r   staticmethodr.   r<   r6   rW   rT   __static_attributes____classcell__)r!   s   @r"   r   r      sk     $-A^  *.    $<|
 
r$   r   N)rd   requestsr   r   requests_oauthlibr   r   r   geopy.geocoders.baser   r   	geopy.excr   geopy.locationr	   geopy.compatr
   r   __all__r    r$   r"   <module>rp      sS   %( ; ( # 2
 
x 
  s   > A	A	