
    .hC                     L   S SK r S SKrS SKrS SKrS SKJr  S SKJrJrJ	r	J
r
JrJr  S SKJrJrJrJrJrJrJrJr  S SKJr  S SKJrJr  SrS\-  r\" S	 \
\4 5       5      r " S
 S5      r\ " S\!4SS 05      " 5       r"\\\\\\\\\\\\\S.r#\!" 5       r$ " S S5      r%S r&S r'g)    N)compat)AdapterHTTPErrorBaseAsyncAdapterBaseSyncAdapterRequestsAdapterURLLibAdapterget_retry_after)ConfigurationErrorGeocoderAuthenticationFailureGeocoderInsufficientPrivilegesGeocoderQueryErrorGeocoderQuotaExceededGeocoderRateLimitedGeocoderServiceErrorGeocoderTimedOut)Point)__version__logger)Geocoderoptionszgeopy/%sc              #   L   #    U  H  nUR                   (       d  M  Uv   M     g 7fN)is_available).0adapter_clss     gC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\geopy/geocoders/base.py	<genexpr>r   #   s"      8 K8s   $	$c                   0    \ rS rSrSr\rSrSrSr	Sr
\rSrg)r   *   a  The `options` object contains default configuration values for
geocoders, e.g. `timeout` and `User-Agent`.
Instead of passing a custom value to each geocoder individually, you can
override a default value in this object.

Please note that not all geocoders use all attributes of this object.
For example, some geocoders don't respect the ``default_scheme``
attribute. Refer to the specific geocoder's initializer doc for a list
of parameters which that geocoder accepts.

Example for overriding default ``timeout`` and ``user_agent``::

    >>> import geopy.geocoders
    >>> from geopy.geocoders import Nominatim
    >>> geopy.geocoders.options.default_user_agent = 'my_app/1'
    >>> geopy.geocoders.options.default_timeout = 7
    >>> geolocator = Nominatim()
    >>> print(geolocator.headers)
    {'User-Agent': 'my_app/1'}
    >>> print(geolocator.timeout)
    7

Attributes:
    default_adapter_factory
        A callable which returns a :class:`geopy.adapters.BaseAdapter`
        instance. Adapters are different implementations of HTTP clients.
        See :mod:`geopy.adapters` for more info.

        This callable accepts two keyword args: ``proxies`` and ``ssl_context``.
        A class might be specified as this callable as well.

        Example::

            import geopy.geocoders
            geopy.geocoders.options.default_adapter_factory = geopy.adapters.URLLibAdapter

            geopy.geocoders.options.default_adapter_factory = (
                lambda proxies, ssl_context: MyAdapter(
                    proxies=proxies, ssl_context=ssl_context, my_custom_arg=42
                )
            )

        If `requests <https://requests.readthedocs.io>`_ package is
        installed, the default adapter is
        :class:`geopy.adapters.RequestsAdapter`. Otherwise it is
        :class:`geopy.adapters.URLLibAdapter`.

        .. versionadded:: 2.0

    default_proxies
        Tunnel requests through HTTP proxy.

        By default the system proxies are respected (e.g.
        `HTTP_PROXY` and `HTTPS_PROXY` env vars or platform-specific
        proxy settings, such as macOS or Windows native
        preferences -- see :func:`urllib.request.getproxies` for
        more details). The `proxies` value for using system proxies
        is ``None``.

        To disable system proxies and issue requests directly,
        explicitly pass an empty dict as a value for `proxies`: ``{}``.

        To use a custom HTTP proxy location, pass a string.
        Valid examples are:

        - ``"192.0.2.0:8080"``
        - ``"john:passw0rd@192.0.2.0:8080"``
        - ``"http://john:passw0rd@192.0.2.0:8080"``

        Please note:

        - Scheme part (``http://``) of the proxy is ignored.
        - Only `http` proxy is supported. Even if the proxy scheme
          is `https`, it will be ignored, and the connection between
          client and proxy would still be unencrypted.
          However, `https` requests via `http` proxy are still
          supported (via `HTTP CONNECT` method).


        Raw urllib-style `proxies` dict might be provided instead of
        a string:

        - ``{"https": "192.0.2.0:8080"}`` -- means that HTTP proxy
          would be used only for requests having `https` scheme.
          String `proxies` value is automatically used for both
          schemes, and is provided as a shorthand for the urllib-style
          `proxies` dict.

        For more information, see
        documentation on :func:`urllib.request.getproxies`.

    default_scheme
        Use ``'https'`` or ``'http'`` as the API URL's scheme.

    default_ssl_context
        An :class:`ssl.SSLContext` instance with custom TLS
        verification settings. Pass ``None`` to use the interpreter's
        defaults (that is to use the system's trusted CA certificates).

        To use the CA bundle used by `requests` library::

            import ssl
            import certifi
            import geopy.geocoders
            ctx = ssl.create_default_context(cafile=certifi.where())
            geopy.geocoders.options.default_ssl_context = ctx

        To disable TLS certificate verification completely::

            import ssl
            import geopy.geocoders
            ctx = ssl.create_default_context()
            ctx.check_hostname = False
            ctx.verify_mode = ssl.CERT_NONE
            geopy.geocoders.options.default_ssl_context = ctx

        See docs for the :class:`ssl.SSLContext` class for more examples.

    default_timeout
        Time, in seconds, to wait for the geocoding service to respond
        before raising a :class:`geopy.exc.GeocoderTimedOut` exception.
        Pass `None` to disable timeout.

    default_user_agent
        User-Agent header to send with the requests to geocoder API.
Nhttps    )__name__
__module____qualname____firstlineno____doc___DEFAULT_ADAPTER_CLASSdefault_adapter_factorydefault_proxiesdefault_schemedefault_ssl_contextdefault_timeout_DEFAULT_USER_AGENTdefault_user_agent__static_attributes__r"       r   r   r   *   s,    ~V 5ONO,r1   r   object__repr__c                     g)NDEFAULT_SENTINELr"   )selfs    r   <lambda>r7      s    2Dr1   )i  i  i  i  i  i  i  i  i  i  i  i  i  c                   |    \ rS rSrSrS\\S\SS.S jrS rS rS r	S	 r
SS
 jr SS jrS r\SSS.S jrS rSrg)r      z 
Template object for geocoders.
N)schemetimeoutproxies
user_agentssl_contextadapter_factoryc                6   U=(       d    [         R                  U l        U R                  S;  a  [        S5      eU[        La  UO[         R
                  U l        U[        La  UO[         R                  U l        SU=(       d    [         R                  0U l
        U[        La  UO[         R                  U l        [        U R                  [        5      (       a  U R                  U R                  S.U l        Uc  [         R                  nU" U R                  U R                  S9U l        [        U R                   ["        5      (       a  SU l        g [        U R                   [&        5      (       a  SU l        g [        S[)        U R                   5      < S35      e)	N)httpr    z)Supported schemes are `http` and `https`.z
User-Agent)r<   r>   FTzAdapter z7 must extend either BaseSyncAdapter or BaseAsyncAdapter)r   r+   r:   r
   r5   r-   r;   r*   r<   r/   headersr,   r>   
isinstancestrr)   adapterr   _Geocoder__run_asyncr   type)r6   r:   r;   r<   r=   r>   r?   s          r   __init__Geocoder.__init__   sE    6 6 6;;//$;  $+2B#B$44 	#*2B#B$44 	$j&NG4N4NO+6>N+NK!(!<!< 	 dllC(($(LL4<<HDL"%==O&LL((
 dllO44$D&677#D$%( r1   c                     U R                   (       a  [        S5      eU R                  R                  5       nXR                  L d   S5       eU $ )zContext manager for synchronous adapters. At exit all
open connections will be closed.

In synchronous mode context manager usage is not required,
and connections will be automatically closed by garbage collection.
z-`async with` must be used with async adapters&adapter's __enter__ must return `self`)rF   	TypeErrorrE   	__enter__r6   ress     r   rM   Geocoder.__enter__  sF     KLLll$$&ll"L$LL"r1   c                 <    U R                   R                  XU5        g r   )rE   __exit__r6   exc_typeexc_valexc_tbs       r   rR   Geocoder.__exit__  s    h8r1   c                    #    U R                   (       d  [        S5      eU R                  R                  5       I Sh  vN nXR                  L d   S5       eU $  N7f)zContext manager for asynchronous adapters. At exit all
open connections will be closed.

In asynchronous mode context manager usage is not required,
however, it is strongly advised to avoid warnings about
resources leaks.
z.`async with` cannot be used with sync adaptersNrK   )rF   rL   rE   
__aenter__rN   s     r   rY   Geocoder.__aenter__  sQ      LMMLL++--ll"L$LL" .s   :AAAc                 X   #    U R                   R                  XU5      I S h  vN   g  N7fr   )rE   	__aexit__rS   s       r   r\   Geocoder.__aexit__#  s     ll$$X???s    *(*c                     [        U[        5      (       d  [        U5      nU[        [        UR                  5      [        UR
                  5      S9-  $ )zJ
Do the right thing on "point" input. For geocoders with reverse
methods.
)latlon)rC   r   dict_format_coordinatelatitude	longitude)r6   pointoutput_formats      r   _coerce_point_to_string Geocoder._coerce_point_to_string&  sK    
 %''%LE t(:5>>(J(:5??(K M M 	Mr1   c           
      v   [        U5      S:w  a  [        S5      eUu  p4[        U5      [        U5      pCU[        [	        UR
                  UR
                  5      [	        UR                  UR                  5      [        UR
                  UR
                  5      [        UR                  UR                  5      S9-  $ )a  
Transform bounding box boundaries to a string matching
`output_format` from the following formats:

    - [Point(lat1, lon1), Point(lat2, lon2)]
    - [[lat1, lon1], [lat2, lon2]]
    - ["lat1,lon1", "lat2,lon2"]

It is guaranteed that lat1 <= lat2 and lon1 <= lon2.
   z%Unsupported format for a bounding box)lat1lon1lat2lon2)lenr   r   ra   minrc   rd   max)r6   bboxrf   p1p2s        r   _format_bounding_boxGeocoder._format_bounding_box8  s     t9>$%LMMrE"IBtR[["++)F),R\\2<<)H),R[["++)F),R\\2<<)H J J 	Jr1   c                     g)a=  
Geocoder-specific exceptions handler.
Override if custom exceptions processing is needed.
For example, raising an appropriate GeocoderQuotaExceeded on non-200
response with a textual message in the body about the exceeded quota.

Return `NONE_RESULT` to have the geocoding call return `None` (meaning
empty result).
Nr"   )r6   errors     r   _geocoder_exception_handler$Geocoder._geocoder_exception_handlerN  s     	r1   T)r;   is_jsonrB   c                  ^ ^^
 T R                   R                  5       nU(       a  UR                  U5        U[        La  UOT R                  n U(       a  T R
                  R                  XUS9m
OT R
                  R                  XUS9m
T R                  (       a  UU
U 4S jnU" 5       $ T" T
5      $ ! [         a%  nT R                  U5      n	U	[        L a   SnAge SnAff = f)z-
For a generated query URL, get the results.
)r;   rB   c                     >#     T" TI S h  vN 5      n [         R                  " U 5      (       a
  U I S h  vN n U $  N/ N! [         a%  nTR                  U5      n U [        L a   S nAg e S nAff = f7fr   )inspectisawaitable	Exception_adapter_error_handlerNONE_RESULT)rO   rx   callbackresultr6   s     r   fut$Geocoder._call_geocoder.<locals>.futt  si     	&V|4"..s33(+)C"
 (4"+$ "99%@+-#'	sO   A2A  <(A  >A  A2A  A   
A/
A*$A2)A**A//A2N)rB   copyupdater5   r;   rE   get_jsonget_textrF   r   r   r   )r6   urlr   r;   r{   rB   req_headersr   rx   rO   r   s   ` `       @r   _call_geocoderGeocoder._call_geocoderZ  s     ll'')w'%-==7 		..s[.Y..s[.Y
 u'' 	--e4Ck!		s%   AB2 *B2 2
C!<CCC!c                    [        U[        5      (       a  UR                  (       a+  [        R                  " SUR
                  UR                  SS9  U R                  U5      nU[        L a  [        $ [        R                  UR
                  [        5      n[        U[        5      (       a$  U" [        U5      [        UR                  5      S9UeU" [        U5      5      UeU R                  U5      nU[        L a  [        $ g )NzReceived an HTTP error (%s): %sF)exc_info)retry_after)rC   r   textr   infostatus_codery   r   ERROR_CODE_MAPgetr   
issubclassr   rD   r	   rB   )r6   rx   rO   exc_clss       r   r   Geocoder._adapter_error_handler  s    e-..zz5%%JJ"	 2259Ck!""$(():):<PQG'#677JOEMM,J c%j)u42259Ck!"" "r1   )__run_asyncrE   rB   r<   r:   r>   r;   )z%(lat)s,%(lon)s)z#%(lat1)s,%(lon1)s,%(lat2)s,%(lon2)s)r#   r$   r%   r&   r'   r5   rH   rM   rR   rY   r\   rg   ru   ry   r   r   r0   r"   r1   r   r   r      sc     $$( (T9@M& #HJ,
" %-^#r1   r   c                 ,    [        U 5      S:  a  U $ U S $ )Nr!   z.7f)abs)
coordinates    r   rb   rb     s    
:!r1   c                    ^ ^^^^^ [         R                  " 5       mU U4S jmSmSmUUU 4S jm[        R                  " T 5      UU4S j5       nU$ )zA decorator for geocoder methods which makes the method always run
under a lock. The lock is reentrant.

This decorator transparently handles sync and async working modes.
c                 V   > T   T" U /UQ70 UD6sS S S 5        $ ! , (       d  f       g = fr   r"   )r6   argskwargsfunc	sync_locks      r   locked_sync"_synchronized.<locals>.locked_sync  s"    .t.v. YYs   
(Nc                 &  >#    Tc  [         R                  " 5       mTR                  5       (       aP  Tc   e[        R                  " 5       TL a3  T" U /UQ70 UD6n[
        R                  " U5      (       a
  UI S h  vN nU$ T IS h  vN   [        R                  " 5       m T" U /UQ70 UD6n[
        R                  " U5      (       a
  UI S h  vN nUS msS S S 5      IS h  vN   $  Nm Nb N N! S mf = f! , IS h  vN  (       d  f       g = f7fr   )asyncioLocklockedr   current_taskr~   r   )r6   r   r   rO   
async_lockasync_lock_taskr   s       r   locked_async#_synchronized.<locals>.locked_async  s       J"...""$741$1&1&&s++ #)C
:$113O'41$1&1&&s++ #)C"& :: $ 
 $  #' ::s   A7D:C(;DC*DC7",C0C,C0C7D"C.#D*D,C0.D0C44C77D=D >D
Dc                 v   > [        U R                  [        5      nU(       a  T" U /UQ70 UD6$ T" U /UQ70 UD6$ r   )rC   rE   r   )r6   r   r   	run_asyncr   r   s       r   f_synchronized.<locals>.f  sA    t||-=>	6t6v66t5d5f55r1   )	threadingRLock	functoolswraps)r   r   r   r   r   r   r   s   ` @@@@@r   _synchronizedr     sK     !I/ JO'2 __T6 6 Hr1   )(r   r   r~   r   geopyr   geopy.adaptersr   r   r   r   r   r	   	geopy.excr
   r   r   r   r   r   r   r   geopy.pointr   
geopy.utilr   r   __all__r.   nextr(   r   rG   r2   r5   r   r   r   rb   r   r"   r1   r   <module>r      s         	 	 	  *
 !;.  '8  Q- Q-l 6)#%DEG I  
	&		'	&								  hI# I#d5r1   