
    iY                     ^    d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	  G d d          Z
dgZdS )	z%GEO property values from :rfc:`5545`.    )AnyClassVar)Self)JCalParsingError)
Parametersc                   R   e Zd ZU dZdZee         ed<   eed<   	 dde	ee
f         dz  deeez  ez  eez  ez  f         fdZdefd	Zed
edeeef         fd            ZdedefdZdefdZdefdZdedefdZedee         fd            ZddlmZ ededefd            ZdS )vGeoa  Geographic Position

    Property Name:
        GEO

    Purpose:
        This property specifies information related to the global
        position for the activity specified by a calendar component.

    Value Type:
        FLOAT.  The value MUST be two SEMICOLON-separated FLOAT values.

    Property Parameters:
        IANA and non-standard property parameters can be specified on
        this property.

    Conformance:
        This property can be specified in "VEVENT" or "VTODO"
        calendar components.

    Description:
        This property value specifies latitude and longitude,
        in that order (i.e., "LAT LON" ordering).  The longitude
        represents the location east or west of the prime meridian as a
        positive or negative real number, respectively.  The longitude and
        latitude values MAY be specified up to six decimal places, which
        will allow for accuracy to within one meter of geographical
        position.  Receiving applications MUST accept values of this
        precision and MAY truncate values of greater precision.

        Example:

        .. code-block:: ics

            GEO:37.386013;-122.082932

        Parse vGeo:

        .. code-block:: pycon

            >>> from icalendar.prop import vGeo
            >>> geo = vGeo.from_ical('37.386013;-122.082932')
            >>> geo
            (37.386013, -122.082932)

        Add a geo location to an event:

        .. code-block:: pycon

            >>> from icalendar import Event
            >>> event = Event()
            >>> latitude = 37.386013
            >>> longitude = -122.082932
            >>> event.add('GEO', (latitude, longitude))
            >>> event['GEO']
            vGeo((37.386013, -122.082932))
    FLOATdefault_valueparamsNgeoc                    	 |d         |d         }}t          |          }t          |          }n"# t          $ r}t          d          |d}~ww xY w|| _        || _        t          |          | _        dS )zCreate a new vGeo from a tuple of (latitude, longitude).

        Raises:
            ValueError: if geo is not a tuple of (latitude, longitude)
        r      z7Input must be (float, float) for latitude and longitudeN)float	Exception
ValueErrorlatitude	longituder   r   )selfr   r   r   r   es         M/root/projects/butler/venv/lib/python3.11/site-packages/icalendar/prop/geo.py__init__zvGeo.__init__H   s    	#&q63q6iHXHi((II 	 	 	I 	 !" ((s   .1 
AAAreturnc                 $    | j          d| j         S )N;)r   r   r   s    r   to_icalzvGeo.to_ical_   s    -22$.222    icalc                     	 |                      d          \  }}t          |          t          |          fS # t          $ r}t          d|            |d }~ww xY w)Nr   zExpected 'float;float' , got: )splitr   r   r   )r   r   r   r   s       r   	from_icalzvGeo.from_icalb   sq    	M"&**S//Hi(OOU9%5%566 	M 	M 	MDdDDEE1L	Ms   58 
AAAotherc                     t          |t                    o)|                                 |                                k    S N)
isinstancer	   r   )r   r#   s     r   __eq__zvGeo.__eq__j   s,    %&&L4<<>>U]]__+LLr   c                 8    t          | j        | j        f          S )zHash of the vGeo object.)hashr   r   r   s    r   __hash__zvGeo.__hash__m   s    T]DN3444r   c                 @    | j         j         d| j         d| j         dS )z
repr(self)z((z, z)))	__class____name__r   r   r   s    r   __repr__zvGeo.__repr__q   s*    .)PPT]PPdnPPPPr   namec                     || j                                         | j                                        | j        | j        ggS )zConvert to jCal object.)r   to_jcalVALUElowerr   r   )r   r/   s     r   r1   zvGeo.to_jcalu   s?     K!!J]DN+	
 	
r   c                      | d          gS )zExamples of vGeo.)gYjhB@gN^ )clss    r   exampleszvGeo.examples~   s     ,--..r   r   )r2   jcal_propertyc                 t    t          j        ||             | |d         t          j        |                    S )zParse jCal from :rfc:`7265`.

        Parameters:
            jcal_property: The jCal property to parse.

        Raises:
            ~error.JCalParsingError: If the provided jCal is invalid.
           )r   validate_propertyr   from_jcal_property)r6   r8   s     r   	from_jcalzvGeo.from_jcal   sA     	*=#>>>s!)-88
 
 	
r   r%   )r-   
__module____qualname____doc__r   r   str__annotations__r   dictr   tupler   intr   r   staticmethodr"   objectboolr'   r*   r.   listr1   classmethodr   r7   icalendar.paramr2   r=   r5   r   r   r	   r	   
   s        8 8t $+M8C=*** )-	) ) S#X%	)53;$eckC&778) ) ) ).3 3 3 3 3 M MeUl 3 M M M \MMF Mt M M M M5# 5 5 5 5Q# Q Q Q Q
C 
D 
 
 
 
 /d / / / [/ &%%%%%
d 
t 
 
 
 [
 
 
r   r	   N)r@   typingr   r   icalendar.compatibilityr   icalendar.errorr   icalendar.parserr   r	   __all__r5   r   r   <module>rQ      s    + +                 ( ( ( ( ( ( , , , , , , ' ' ' ' ' 'I
 I
 I
 I
 I
 I
 I
 I
X (r   