
    =h'                     h    S r S rS rS rS rS rS rS rS rS	 r	S
 r
S rS rS rS rS rS rg)zConverts Python types to string representations suitable for Maps API server.

For example:

sydney = {
    "lat" : -33.8674869,
    "lng" : 151.2069902
}

convert.latlng(sydney)
# '-33.8674869,151.2069902'
c                 Z    S[        U 5      -  R                  S5      R                  S5      $ )a  Formats a float value to be as short as possible.

Truncates float to 8 decimal places and trims extraneous
trailing zeros and period to give API args the best
possible chance of fitting within 2000 char URL length
restrictions.

For example:

format_float(40) -> "40"
format_float(40.0) -> "40"
format_float(40.1) -> "40.1"
format_float(40.001) -> "40.001"
format_float(40.0010) -> "40.001"
format_float(40.000000001) -> "40"
format_float(40.000000009) -> "40.00000001"

:param arg: The lat or lng float.
:type arg: float

:rtype: string
z%.8f0.)floatrstripargs    eC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\googlemaps/convert.pyformat_floatr
       s)    . U3Z'',33C88    c                 ~    [        U 5      (       a  U $ [        U 5      n[        US   5      < S[        US   5      < 3$ )a`  Converts a lat/lon pair to a comma-separated string.

For example:

sydney = {
    "lat" : -33.8674869,
    "lng" : 151.2069902
}

convert.latlng(sydney)
# '-33.8674869,151.2069902'

For convenience, also accepts lat/lon pair as a string, in
which case it's returned unchanged.

:param arg: The lat/lon pair.
:type arg: string or dict or list or tuple
    ,   )	is_stringnormalize_lat_lngr
   )r   
normalizeds     r	   latlngr   :   s9    & ~~
"3'J":a=1<
13NOOr   c                     [        U [        5      (       a,  SU ;   a  SU ;   a
  U S   U S   4$ SU ;   a  SU ;   a
  U S   U S   4$ [        U 5      (       a
  U S   U S   4$ [        S[	        U 5      R
                  -  5      e)a  Take the various lat/lng representations and return a tuple.

Accepts various representations:
1) dict with two entries - "lat" and "lng"
2) list or tuple - e.g. (-33, 151) or [-33, 151]

:param arg: The lat/lng pair.
:type arg: dict or list or tuple

:rtype: tuple (lat, lng)
latlnglatitude	longituder   r   z,Expected a lat/lng dict or tuple, but got %s)
isinstancedict_is_list	TypeErrortype__name__r   s    r	   r   r   T   s     #tC<ESLu:s5z))!3z?C$444 }}1vs1v~
	Cy))	*+ +r   c                     [        U [        5      (       a  [        U 5      $ SR                  [	        U 5       Vs/ s H  n[        U5      PM     sn5      $ s  snf )a.  Joins a list of locations into a pipe separated string, handling
the various formats supported for lat/lng values.

For example:
p = [{"lat" : -33.867486, "lng" : 151.206990}, "Sydney"]
convert.waypoint(p)
# '-33.867486,151.206990|Sydney'

:param arg: The lat/lng list.
:type arg: list

:rtype: string
|)r   tupler   joinas_list)r   locations     r	   location_listr%   o   sE     #uc{xx'#,G,h),GHHGs   Ac                 6    U R                  [        U5      5      $ )zIf arg is list-like, then joins it with sep.

:param sep: Separator string.
:type sep: string

:param arg: Value to coerce into a list.
:type arg: string or list of strings

:rtype: string
)r"   r#   )sepr   s     r	   	join_listr(      s     88GCL!!r   c                 ,    [        U 5      (       a  U $ U /$ )zCoerces arg into a list. If arg is already list-like, returns arg.
Otherwise, returns a one-element list containing arg.

:rtype: list
)r   r   s    r	   r#   r#      s     }}
5Lr   c                     [        U [        5      (       a  g[        U [        5      (       a  g[        U S5      (       d  [        U S5      $ [        U S5      $ )z<Checks if arg is list-like. This excludes strings and dicts.Fstrip__getitem____iter__)r   r   str_has_methodr   s    r	   r   r      sJ    #t#s2=c72K2K;sM*mQ\]`blQmmr   c                 p     [           [        U [         5      $ ! [         a    [        U [        5      s $ f = f)z>Determines whether the passed value is a string, safe for 2/3.)
basestring	NameErrorr   r.   )vals    r	   r   r      s7    $ c:&&  $#s##$s    55c                     [        U S5      (       a  U R                  5       n [        U [        5      (       a  [	        U 5      n [        U 5      $ )zConverts the value into a unix time (seconds since unix epoch).

For example:
    convert.time(datetime.now())
    # '1409810596'

:param arg: The time.
:type arg: datetime.datetime or int
	timestamp)r/   r5   r   r   intr.   r   s    r	   timer7      s;     3$$mmo#u#hs8Or   c                 N    [        X5      =(       a    [        [        X5      5      $ )zReturns true if the given object has a method with the given name.

:param arg: the object

:param method: the method name
:type method: string

:rtype: bool
)hasattrcallablegetattr)r   methods     r	   r/   r/      s     3BHWS-A$BBr   c                     S n[        U [        5      (       a   SR                  [        U" U 5      5      5      $ [	        S[        U 5      R                  -  5      e)a
  Converts a dict of components to the format expected by the Google Maps
server.

For example:
c = {"country": "US", "postal_code": "94043"}
convert.components(c)
# 'country:US|postal_code:94043'

:param arg: The component filter.
:type arg: dict

:rtype: basestring
c              3   x   #    U R                  5        H"  u  p[        U5       H  nU< SU< 3v   M     M$     g 7f)N:)itemsr#   )r   kvitems       r	   expandcomponents.<locals>.expand   s0     IIKDA
!"D)) #  s   8:r    z*Expected a dict for components, but got %s)r   r   r"   sortedr   r   r   )r   rD   s     r	   
componentsrG      sR    $*
 #txxvc{+,,
	Cy))	*+ +r   c                 @   [        U 5      (       a,  U R                  S5      S:X  a  U R                  S5      S:X  a  U $ [        U [        5      (       a-  SU ;   a'  SU ;   a!  [	        U S   5      < S[	        U S   5      < 3$ [        S[        U 5      R                  -  5      e)a]  Converts a lat/lon bounds to a comma- and pipe-separated string.

Accepts two representations:
1) string: pipe-separated pair of comma-separated lat/lon pairs.
2) dict with two entries - "southwest" and "northeast". See convert.latlng
for information on how these can be represented.

For example:

sydney_bounds = {
    "northeast" : {
        "lat" : -33.4245981,
        "lng" : 151.3426361
    },
    "southwest" : {
        "lat" : -34.1692489,
        "lng" : 150.502229
    }
}

convert.bounds(sydney_bounds)
# '-34.169249,150.502229|-33.424598,151.342636'

:param arg: The bounds.
:type arg: dict
r    r   r      	southwest	northeastz8Expected a bounds (southwest/northeast) dict, but got %s)r   countr   r   r   r   r   r   r   s    r	   boundsrM      s    8 ~~#))C.A-#))C.A2E
	C		#+"4$S%56$S%568 8 	Cy))	*+ +r   c                     [        U [        5      (       a	  U < SU < 3$ [        U 5      (       a  U S   < SU S   < 3$ [        S[	        U 5      R
                  -  5      e)Nxr   r   z'Expected a size int or list, but got %s)r   r6   r   r   r   r   r   s    r	   sizerP     sZ    #ss##	#a&#a&))
	Cy))	*+ +r   c                    / nS=n=p4U[        U 5      :  a  SnSn [        X   5      S-
  S-
  nUS-  nXWU-  -  nUS-  nUS:  a  OM-  X5S-  S:w  a  U) S-	  OUS-	  -  nSnSn [        X   5      S-
  S-
  nUS-  nXWU-  -  nUS-  nUS:  a  OM-  XES-  S:w  a  US-	  ) OUS-	  -  nUR                  US-  US-  S.5        U[        U 5      :  a  M  U$ )a0  Decodes a Polyline string into a list of lat/lng dicts.

See the developer docs for a detailed description of this encoding:
https://developers.google.com/maps/documentation/utilities/polylinealgorithm

:param polyline: An encoded polyline
:type polyline: string

:rtype: list of dicts with lat/lng keys
r   r   ?         gh㈵>)r   r   )lenordappend)polylinepointsindexr   r   resultshiftbs           r	   decode_polyliner^   "  s2    FEC
#h-
HO$r)A-AQJE5j FQJE4x  	1*!211EHO$r)A-AQJE5j FQJE4x  	1*!21~1EcDjt<=/ #h-
2 Mr   c                 d   S=pSnU  H  n[        U5      n[        [        US   S-  5      5      n[        [        US   S-  5      5      nXa-
  nXr-
  n	X4 HO  n
U
S:  a  U
S-  ) OU
S-  n
U
S:  a$  U[        SU
S-  -  S-   5      -  nU
S-  n
U
S:  a  M$  U[        U
S-   5      -  nMQ     UnUnM     U$ )	a!  Encodes a list of points into a polyline string.

See the developer docs for a detailed description of this encoding:
https://developers.google.com/maps/documentation/utilities/polylinealgorithm

:param points: a list of lat/lng pairs
:type points: list of dicts or tuples

:rtype: string
r    g     j@r       rT   rR   rS   )r   r6   roundchr)rY   last_latlast_lngr[   pointllr   r   d_latd_lngrB   s              r	   encode_polylinerj   L  s     HFu%%1$%%1$%AU!q&	QAt)3D 1R789a t) s1r6{#F    " Mr   c                     [        U [        5      (       a  U /n S[        U 5      -  n[        U 5      n[	        U5      [	        U5      :  a  U$ U$ )aM  Returns the shortest representation of the given locations.

The Elevations API limits requests to 2000 characters, and accepts
multiple locations either as pipe-delimited lat/lng values, or
an encoded polyline, so we determine which is shortest and use it.

:param locations: The lat/lng list.
:type locations: list

:rtype: string
zenc:%s)r   r!   rj   r%   rU   )	locationsencoded	unencodeds      r	   shortest_pathro   n  sL     )U##K	33Gi(I
7|c)n$r   N)__doc__r
   r   r   r%   r(   r#   r   r   r7   r/   rG   rM   rP   r^   rj   ro    r   r	   <module>rr      sa   $94P4+6I*"n'(
C+>%+P+'TDr   