
    mhd                         d Z ddlmZ ddlmZ ddlZddlmZ ddlZdZdej	        j
        fdZd	 Zd
 Zd Zd Zedk    r$	  e             dS # e$ r  ed           Y dS w xY wdS )z7Translate an ics file's events to a different timezone.    )datetime)OptionParserN)tzz0.1Fc                 D   t          | dg           D ]}t          |dd          }t          |dd          }||fD ]d}|r`|j        }	t          |	t                    rD|r|	j        |k    r7|	j        |	                    |          }	|	                    |          |_        edS )a  
    Change the timezone of the specified component.

    Args:
        cal (Component): the component to change
        new_timezone (tzinfo): the timezone to change to
        default (tzinfo): a timezone to assume if the dtstart or dtend in cal doesn't have an existing timezone
        utc_only (bool): only convert dates that are in utc
        utc_tz (tzinfo): the tzinfo to compare to for UTC when processing utc_only=True
    vevent_listdtstartNdtend)tzinfo)getattrvalue
isinstancer   r
   replace
astimezone)
calnew_timezonedefaultutc_onlyutc_tzveventstartendnodedts
             Q/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/vobject/change_tz.py	change_tzr      s     #}b11 	= 	=	400fgt,,CL 	= 	=D =Zb(++ =X =fATATy(ZZwZ77!#|!<!<DJ	=	= 	=    c                  B    t           j        D ]} t          |            d S )N)pytzall_timezonesprint)	tz_strings    r   show_timezonesr"   &   s/    '  	i r   c                    t          d                    | rdnd                     |d         }t          |          dk    r|d         nd}t          d                    |                     t          j        t          |                    }t          |t          j        |          t          j        d          |            d	                    |          }t          d
                    |                     t          |d          5 }|	                    |           d d d            n# 1 swxY w Y   t          d           d S )NzConverting {} eventszonly UTCallr      UTCz... Reading {})r   r   r   z{}.convertedz... Writing {}wbDone)
r    formatlenvobjectreadOneopenr   r   gettz	serialize)r   argsics_file_tzoner   out_nameouts          r   convert_eventsr5   +   s]   	
 
'
'h(I

E
J
JKKKAwHD		AT!WW5F	

!
!(
+
+,,,
/$x..
)
)Cc 0 0"(5//T\]]]]$$X..H	

!
!(
+
+,,,	h		 c               
&MMMMMs   D//D36D3c                      t                      \  } }| j        rt                       d S |rt          | j        |           d S d S )N)r   r0   )get_optionslistr"   r5   utc)optionsr0   s     r   mainr;   <   sX    MMMGT| 8	 8$7777778 8r   c                     d} t          | t          j                  }|                    d           |                    dddddd	
           |                    dddddd
           |                                \  }}|s;|j        s4t          d           t          |                                           |dfS ||fS )Nz*usage: %prog [options] ics_file [timezone])usageversionz5change_tz will convert the timezones in an ics file. z-uz
--only-utcr9   
store_trueFzOnly change UTC events.)destactionr   helpz-lz--listr8   zList available timezoneszerror: too few arguments given)	r   r+   VERSIONset_description
add_option
parse_argsr8   r    format_help)r=   parsercmdline_optionsr0   s       r   r7   r7   E   s    <Ew???F
RSSS
dLu\#*C  E E E
dH6,#*D  F F F %//11_d &O( &.///f  ""###%%D  r   __main__Aborted)__doc__r   optparser   r   dateutilr   r+   r>   	icalendarr9   r   r"   r5   r;   r7   __name__KeyboardInterruptr     r   r   <module>rS      s   = =       ! ! ! ! ! !        
 49ARAV = = = =0  
  "8 8 8! ! !( z   i s   
A A"!A"