
    4bhe                     z   	 d dl Z d dlZd dlmZmZ d dlZd dlmZ d dl	Z	g dZ
eZ G d dee      Z G d de      Zd	 Ze G d
 de             Ze G d de             Zg dZ G d d      Z G d d      Z ed      Z ed      Z ed      Z ed      Zd Zd Zd Zd Zd Zd Zd Z d Z! G d d e"      Z# G d! d"e#      Z$ G d# d$e#      Z% G d% d&      Z&d' Z' G d( d)e$      Z( G d* d+e%      Z) e$       Z*e*jV                  Z,d, Z-e*j\                  Z/e*j`                  Z0e*jb                  Z2e*jf                  Z4e*jj                  Z5e*jl                  Z7e*jp                  Z9e*jt                  Z;d-Z<d.Z=e<e=fd/Z>e<e=fd0Z?d1Z@ ej                  e@d2d2      j                         ZCd3 ZDd4 ZEeFd5k(  r eEe j                         yy)6    N)IntEnumglobal_enum)repeat)-IllegalMonthErrorIllegalWeekdayErrorsetfirstweekdayfirstweekdayisleapleapdaysweekday
monthrangemonthcalendarprmonthmonthprcalcalendartimegm
month_name
month_abbrday_nameday_abbrCalendarTextCalendarHTMLCalendarLocaleTextCalendarLocaleHTMLCalendar
weekheaderDayMonthJANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUST	SEPTEMBEROCTOBERNOVEMBERDECEMBERMONDAYTUESDAY	WEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAYc                       e Zd Zd Zd Zy)r   c                     || _         y Nr   )selfr   s     2/opt/python-3.12.12/usr/lib/python3.12/calendar.py__init__zIllegalMonthError.__init__"   s	    
    c                      d| j                   z  S )Nz!bad month number %r; must be 1-12r6   r7   s    r8   __str__zIllegalMonthError.__str__$   s    2TZZ??r:   N__name__
__module____qualname__r9   r=    r:   r8   r   r   !   s    @r:   r   c                       e Zd Zd Zd Zy)r   c                     || _         y r5   r   )r7   r   s     r8   r9   zIllegalWeekdayError.__init__)   s	    r:   c                      d| j                   z  S )Nz7bad weekday number %r; must be 0 (Monday) to 6 (Sunday)rE   r<   s    r8   r=   zIllegalWeekdayError.__str__+   s    H4<<WWr:   Nr>   rB   r:   r8   r   r   (   s    Xr:   r   c                     | dv r8t        j                  d|  d| j                          dt        d       | dk(  ryyt	        d	t
         d
|  d      )N)JanuaryFebruaryzThe 'z ' attribute is deprecated, use 'z	' instead   )
stacklevelrH      zmodule 'z' has no attribute '')warningswarnupperDeprecationWarningAttributeErrorr?   )names    r8   __getattr__rT   /   s^    &&dV#CDJJL>QZ[(Q	89
8H:-A$qI
JJr:   c                   <    e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZy)r   rL   rJ                     	   
         N)r?   r@   rA   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   rB   r:   r8   r   r   <   s>    GHEE
CDDFIGHHr:   r   c                   (    e Zd ZdZdZdZdZdZdZdZ	y)	r   r   rL   rJ   rV   rW   rX   rY   N)
r?   r@   rA   r,   r-   r.   r/   r0   r1   r2   rB   r:   r8   r   r   M   s%    FGIHFHFr:   r   )r         ra      ra   rc   ra   ra   rc   ra   rc   ra   c            
           e Zd Z ed      D  cg c]&  }t	        j
                  d|dz   d      j                  ( c}}} Zej                  dd        d Z	d Z
d Zy	c c}}} w )
_localized_monthr_     rL   r   c                      y)N rB   )xs    r8   <lambda>z_localized_month.<lambda>c   s    r:   c                     || _         y r5   formatr7   rm   s     r8   r9   z_localized_month.__init__e   	    r:   c                     | j                   |   }t        |t              r |D cg c]  } || j                         c}S  || j                        S c c}w r5   )_months
isinstanceslicerm   r7   ifuncsfs       r8   __getitem__z_localized_month.__getitem__h   sJ    Qa,12EqAdkkNE22%% 3   Ac                      y)N   rB   r<   s    r8   __len__z_localized_month.__len__o   s    r:   N)r?   r@   rA   rangedatetimedatestrftimerq   insertr9   rx   r|   .0ru   r~   s   000r8   re   re   `   sT    =B2YGYx}}T1Q3*33YGGNN1l#& Hs   +Are   c                       e Zd Z ed      D  cg c]&  }t	        j
                  dd|dz         j                  ( c}}} Zd Zd Z	d Z
yc c}}} w )_localized_dayrZ   rf   rL   c                     || _         y r5   rl   rn   s     r8   r9   z_localized_day.__init__x   ro   r:   c                     | j                   |   }t        |t              r |D cg c]  } || j                         c}S  || j                        S c c}w r5   )_daysrr   rs   rm   rt   s       r8   rx   z_localized_day.__getitem__{   sJ    

1a,12EqAdkkNE22%% 3ry   c                      yNrZ   rB   r<   s    r8   r|   z_localized_day.__len__   s    r:   N)r?   r@   rA   r}   r~   r   r   r   r9   rx   r|   r   s   000r8   r   r   s   sI     <A8D8aX]]4AaC(118DE& Es   +Ar   z%Az%az%Bz%bc                 <    	 | dz  dk(  xr | dz  dk7  xs | dz  dk(  S )NrW   r   d     rB   )years    r8   r
   r
      s-    ?!8q=AdSjAo@qAr:   c                 ^    	 | dz  } |dz  }|dz  | dz  z
  |dz  | dz  z
  z
  |dz  | dz  z
  z   S )NrL   rW   r   r   rB   )y1y2s     r8   r   r      sO    !GB!GBEBEMb#gC/0BGb#g4EFFr:   c                     	 t         j                  | cxk  rt         j                  k  s
n d| dz  z   } t        t        j                  | ||      j                               S )Ni  r   )r~   MINYEARMAXYEARr   r   r   )r   r   days      r8   r   r      sM    Lt7x'7'77dSj x}}T5#.66899r:   c                 H    d| cxk  rdk  st        |        t        |       y NrL   r_   )r   r6   s    r8   _validate_monthr      s/    && && r:   c                 |    	 t        |       t        | |d      }t        |   |t        k(  xr t	        |       z   }||fS )NrL   )r   r   mdaysr!   r
   )r   r   day1ndayss       r8   r   r      sC    6E4"D%LEX->&,?E;r:   c                 B    t         |   |t        k(  xr t        |       z   S r5   )r   r!   r
   r   r   s     r8   	_monthlenr      s    <5H,=>>r:   c                 (    |dk(  r| dz
  dfS | |dz
  fS r   rB   r   s     r8   
_prevmonthr      s%    zAvrzU1W}r:   c                 (    |dk(  r| dz   dfS | |dz   fS )Nr_   rL   rB   r   s     r8   
_nextmonthr      s%    {AvqyU1W}r:   c                       e Zd Z	 ddZd Zd Z eee      Zd Zd Z	d Z
d Zd Zd	 Zd
 Zd Zd ZddZddZddZy)r   c                     || _         y r5   r	   r7   r	   s     r8   r9   zCalendar.__init__   s
    (r:   c                      | j                   dz  S r   _firstweekdayr<   s    r8   getfirstweekdayzCalendar.getfirstweekday   s    !!A%%r:   c                     || _         y r5   r   r   s     r8   r   zCalendar.setfirstweekday   s
    )r:   c              #   l   K   	 t        | j                  | j                  dz         D ]	  }|dz    y wr   )r}   r	   )r7   ru   s     r8   iterweekdayszCalendar.iterweekdays   s9     	 t(($*;*;a*?@AA#I As   24c              #   v   K   	 | j                  ||      D ]  \  }}}t        j                  |||       ! y wr5   )itermonthdays3r~   r   )r7   r   r   ymds         r8   itermonthdateszCalendar.itermonthdates   s=     	
 **47GAq!--1a(( 8s   79c              #     K   	 t        ||      \  }}|| j                  z
  dz  }t        d|      E d {    t        d|dz         E d {    | j                  |z
  |z
  dz  }t        d|      E d {    y 7 E7 07 	w)NrZ   r   rL   )r   r	   r   r}   )r7   r   r   r   r   days_before
days_afters          r8   itermonthdayszCalendar.itermonthdays   s     	 !u-ed///14![)))EAI&&&''$.6!;
!Z((( 	*&(s3   2B A:B A<(B 4A>5B <B >B c              #   |   K   	 t        | j                  ||      | j                        D ]  \  }}||dz  f  y wr   )	enumerater   r	   )r7   r   r   ru   r   s        r8   itermonthdays2zCalendar.itermonthdays2   sC     	 d00u=t?P?PQDAqQU(N Rs   :<c              #   v  K   	 t        ||      \  }}|| j                  z
  dz  }| j                  |z
  |z
  dz  }t        ||      \  }}t        ||      dz   }	t	        |	|z
  |	      D ]	  }
|||
f  t	        d|dz         D ]	  }
|||
f  t        ||      \  }}t	        d|dz         D ]	  }
|||
f  y w)NrZ   rL   )r   r	   r   r   r}   r   )r7   r   r   r   r   r   r   r   r   endr   s              r8   r   zCalendar.itermonthdays3   s     	 !u-ed///14''$.6!;
$&11o!s;,AQ'M -q%!)$Aq.  %$&1q*q.)AQ'M *s   B7B9c              #      K   	 t        | j                  ||            D ]!  \  }\  }}}|||| j                  |z   dz  f # y wr   )r   r   r	   )r7   r   r   ru   r   r   r   s          r8   itermonthdays4zCalendar.itermonthdays4
  sS     	 &d&9&9$&FGLAy1aQD--1Q666 Hs   AAc                     	 t        | j                  ||            }t        dt        |      d      D cg c]
  }|||dz     c}S c c}w Nr   rZ   )listr   r}   len)r7   r   r   datesru   s        r8   monthdatescalendarzCalendar.monthdatescalendar  sQ    	 T((u56',QE
A'>@'>!q1'>@@@   Ac                     	 t        | j                  ||            }t        dt        |      d      D cg c]
  }|||dz     c}S c c}w r   )r   r   r}   r   r7   r   r   daysru   s        r8   monthdays2calendarzCalendar.monthdays2calendar  sQ    	 D''e45&+As4y!&<>&<a!&<>>>r   c                     	 t        | j                  ||            }t        dt        |      d      D cg c]
  }|||dz     c}S c c}w r   )r   r   r}   r   r   s        r8   monthdayscalendarzCalendar.monthdayscalendar$  sQ    	 D&&tU34&+As4y!&<>&<a!&<>>>r   c                     	 t         D cg c]  }| j                  ||       }}t        dt        |      |      D cg c]
  }||||z     c}S c c}w c c}w Nr   )r   r   r}   r   r7   r   widthr   monthsru   s         r8   yeardatescalendarzCalendar.yeardatescalendar,  c    	 =BBEq$))$2EB+0CK+GI+Gaq5!+GII CI
   AAc                     	 t         D cg c]  }| j                  ||       }}t        dt        |      |      D cg c]
  }||||z     c}S c c}w c c}w r   )r   r   r}   r   r   s         r8   yeardays2calendarzCalendar.yeardays2calendar6  r   r   c                     	 t         D cg c]  }| j                  ||       }}t        dt        |      |      D cg c]
  }||||z     c}S c c}w c c}w r   )r   r   r}   r   r   s         r8   yeardayscalendarzCalendar.yeardayscalendar@  sc    	
 <AA5a$((q15A+0CK+GI+Gaq5!+GII BIr   N)r   rV   )r?   r@   rA   r9   r   r   propertyr	   r   r   r   r   r   r   r   r   r   r   r   r   rB   r:   r8   r   r      sd    
)&* O_=L)
)$7A??JJJr:   r   c                   T    e Zd Z	 d Zd Zd Zd Zd ZddZddZ	ddZ
dd	Zdd
Zy)r   c                 @    	 t        | j                  ||      d       y Nrh   )r   )print
formatweekr7   theweekr   s      r8   prweekzTextCalendar.prweekP  s    	 	doogu-26r:   c                 @    	 |dk(  rd}nd|z  }|j                  |      S )Nr   rh   z%2icenter)r7   r   r   r   ss        r8   	formatdayzTextCalendar.formatdayV  s,    	 !8AAxxr:   c                 >     	 dj                   fd|D              S )N c              3   J   K   | ]  \  }}j                  ||        y wr5   r   )r   r   wdr7   r   s      r8   	<genexpr>z*TextCalendar.formatweek.<locals>.<genexpr>d  s#     LG!Rq"e4Gs    #joinr   s   ` `r8   r   zTextCalendar.formatweek`  s    	 xxLGLLLr:   c                 V    	 |dk\  rt         }nt        }||   d | j                  |      S )Nr\   )r   r   r   )r7   r   r   namess       r8   formatweekdayzTextCalendar.formatweekdayf  s6    	 A:EESz&5!((//r:   c                 Z     	 dj                   fd j                         D              S )Nr   c              3   B   K   | ]  }j                  |        y wr5   r   )r   ru   r7   r   s     r8   r   z0TextCalendar.formatweekheader.<locals>.<genexpr>t  s!     R>Q**1e4>Qs   r   r   )r7   r   s   ``r8   formatweekheaderzTextCalendar.formatweekheaderp  s(    	 xxRd>O>O>QRRRr:   c                 `    	 t        |       t        |   }|r|d|}|j                  |      S )Nr   )r   r   r   )r7   theyearthemonthr   withyearr   s         r8   formatmonthnamezTextCalendar.formatmonthnamev  s6    	 	!x g&Axxr:   c                 D    	 t        | j                  ||||      d       y r   )r   formatmonth)r7   r   r   wls        r8   r   zTextCalendar.prmonth  s$    	 	dw!Q7R@r:   c                 x   	 t        d|      }t        d|      }| j                  ||d|dz   z  dz
        }|j                         }|d|z  z  }|| j                  |      j                         z  }|d|z  z  }| j	                  ||      D ]-  }|| j                  ||      j                         z  }|d|z  z  }/ |S )NrJ   rL   rZ   
)maxr   rstripr   r   r   )r7   r   r   r   r   r   weeks          r8   r   zTextCalendar.formatmonth  s    	 1I1I  (AQK!ODHHJ	TAX	T""1%,,..	TAX++GX>Dq)0022AMA ? r:   c           	          	 t        d|      }t        d|      }t        d|      }|dz   dz  dz
  g }|j                  } |t              j                  |z  ||dz
  z  z         j	                                 |d|z          j                  |      t         j                  |            D ]A  \  }}	t        ||z  dz   t        ||dz   z  dz   d            }
 |d|z          fd|
D        } |t        ||      j	                                 |d|z         fd|
D        } |t        ||      j	                                 |d|z         t        d |	D              }t        |      D ]{  }g }|	D ]F  }|t        |      k\  r|j                  d	       #|j                   j                  ||   |             H  |t        ||      j	                                 |d|z         } D d	j                  |      S )
NrJ   rL   rZ   r  r{   c              3   F   K   | ]  }j                  |d         yw)FN)r   )r   kcolwidthr7   r   s     r8   r   z*TextCalendar.formatyear.<locals>.<genexpr>  s*      &$ ))'1hF$s   !c              3   "   K   | ]  }  y wr5   rB   )r   r  headers     r8   r   z*TextCalendar.formatyear.<locals>.<genexpr>  s     .v!vvs   c              3   2   K   | ]  }t        |        y wr5   )r   )r   cals     r8   r   z*TextCalendar.formatyear.<locals>.<genexpr>  s     1ScSSs   rh   )r  appendreprr   r  r   r   r   r}   minformatstringr   r   r   )r7   r   r   r   cr   varu   rowr   r   headersheightjweeksr  r	  r  s   ``               @@r8   
formatyearzTextCalendar.formatyear  s   	 1I1I1IEQ;?HH	$w-

xz!QqS'1
2
9
9
;<	$q&	&&q)!$"8"8!"DEHQ1Q3q5#a1gai"45Fd1fI&$&El5(A.5578d1fI.v.Gl7Ha0779:d1fI1S11F6]CCH}R(T__SVQ%?@	 
 ,uh299;<$( # F, wwqzr:   c           	      F    	 t        | j                  |||||      d       y r   )r   r  )r7   r   r   r   r  r   s         r8   pryearzTextCalendar.pryear  s     &doogq!Q2;r:   NT)r   r   )rJ   rL   rY   rV   )r   r   rY   rV   )r?   r@   rA   r   r   r   r   r   r   r   r   r  r  rB   r:   r8   r   r   J  s=    
7M0S	A #J<r:   r   c                   f    e Zd Z	 g dZeZdZdZdZdZdZ	d Z
d Zd Zd Zdd	Zdd
ZddZddZy)r   )montuewedthufrisatsunnodayr   r   c                 T    	 |dk(  rd| j                   z  S d| j                  |   |fz  S )Nr   z<td class="%s">&nbsp;</td>z<td class="%s">%d</td>)cssclass_noday
cssclasses)r7   r   r   s      r8   r   zHTMLCalendar.formatday  s:    	 !8/$2E2EEE+tw/G.MMMr:   c                 D     	 dj                   fd|D              }d|z  S )Nrh   c              3   H   K   | ]  \  }}j                  ||        y wr5   r   )r   r   r   r7   s      r8   r   z*HTMLCalendar.formatweek.<locals>.<genexpr>  s!     Agq"DNN1b)s   "<tr>%s</tr>r   )r7   r   r   s   `  r8   r   zHTMLCalendar.formatweek  s)    	 GGAAAq  r:   c                 <    d| j                   |   dt        |   dS )Nz<th class="">z</th>)cssclasses_weekday_headr   )r7   r   s     r8   r   zHTMLCalendar.formatweekday  s'    	 ((-x}> 	>r:   c                 `     	 dj                   fd j                         D              }d|z  S )Nrh   c              3   @   K   | ]  }j                  |        y wr5   r   )r   ru   r7   s     r8   r   z0HTMLCalendar.formatweekheader.<locals>.<genexpr>  s     G3FaD&&q)3F   r,  r   )r7   r   s   ` r8   r   zHTMLCalendar.formatweekheader  s2    	 GGG43D3D3FGGq  r:   c                 z    	 t        |       |rt        |   d|}ndt        |   z  }d| j                  d|dS )Nr   z%sz<tr><th colspan="7" class="r.  z
</th></tr>)r   r   cssclass_month_head)r7   r   r   r   r   s        r8   r   zHTMLCalendar.formatmonthname  sH    	 	!%h/9Az(++A$$a) 	)r:   c                    	 g }|j                   } |d| j                  z          |d        || j                  |||              |d        || j                                 |d       | j	                  ||      D ]!  } || j                  |              |d       #  |d        |d       dj                  |      S )N=<table border="0" cellpadding="0" cellspacing="0" class="%s">r  r   </table>rh   )r  cssclass_monthr   r   r   r   r   )r7   r   r   r   r  r  r  s          r8   r   zHTMLCalendar.formatmonth  s    	 HH	
I! 	"	$	$

w8

DE	$	$


!"	$++GX>Ddood#$dG ? 	
*	$wwqzr:   c           	         	 g }|j                   }t        |d      } |d| j                  z          |d        |d|| j                  |fz         t	        t
        t
        dz   |      D ]\  }t	        |t        ||z   d            } |d       |D ],  } |d        || j                  ||d	
              |d       .  |d       ^  |d       dj                  |      S )NrL   r6  r  z,<tr><th colspan="%d" class="%s">%s</th></tr>r_   r{   z<tr>z<td>Fr7  z</td>z</tr>r8  rh   )	r  r  cssclass_yearcssclass_year_headr}   r    r  r   r   )r7   r   r   r  r  ru   r   r   s           r8   r  zHTMLCalendar.formatyear  s    	 HHE1	
I


 		$	
84**G<5 5 	6w
E2A1c!E'2./FfI&	$""7A">?'
  gJ 3 	
*wwqzr:   Nc                    	 |t        j                         }g }|j                  } |d|z          |d        |d        |d        |d|z         | |d|z          |d|z          |d        |d	        || j                  ||              |d
        |d       dj	                  |      j                  |d      S )Nz$<?xml version="1.0" encoding="%s"?>
zn<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
z<html>
z<head>
zC<meta http-equiv="Content-Type" content="text/html; charset=%s" />
z4<link rel="stylesheet" type="text/css" href="%s" />
z<title>Calendar for %d</title>
z</head>
z<body>
z</body>
z</html>
rh   xmlcharrefreplace)sysgetdefaultencodingr  r  r   encode)r7   r   r   cssencodingr  r  s          r8   formatyearpagezHTMLCalendar.formatyearpage2  s    	 --/HHH	
1H
<=	
{|	*	*	
PS[
[\?EKL	
,w
67	+	*	$//'5
)*	+	+wwqz  +>??r:   r  r   )rV   calendar.cssN)r?   r@   rA   r)  r/  r(  r4  r9  r<  r;  r   r   r   r   r   r   r  rD  rB   r:   r8   r   r     sf    
 CJ ) N " N   MN!>!
)(0@r:   r   c                       e Zd Zd Zd Zd Zy)different_localec                      || _         d | _        y r5   )locale	oldlocale)r7   rI  s     r8   r9   zdifferent_locale.__init__K  s    r:   c                     t        j                  t         j                  d       | _        t        j                  t         j                  | j                         y r5   )_locale	setlocaleLC_TIMErJ  rI  r<   s    r8   	__enter__zdifferent_locale.__enter__O  s2     **7??DA'//4;;7r:   c                 z    | j                   y t        j                  t        j                  | j                          y r5   )rJ  rL  rM  rN  )r7   argss     r8   __exit__zdifferent_locale.__exit__S  s'    >>!'//4>>:r:   N)r?   r@   rA   r9   rO  rR  rB   r:   r8   rG  rG  J  s    8;r:   rG  c                      t        j                  t         j                  d       } | dk(  r:t        d      5  t        j                  t         j                  d       } d d d        | S | S # 1 sw Y   | S xY w)NCrh   )rL  rM  rN  rG  rI  s    r8   _get_default_localerV  Y  s\    w5F}b! &&w=F " M6M	 " Ms   %A&&A0c                   4     e Zd Z	 ddZ fdZd fd	Z xZS )r   c                 V    t         j                  | |       |
t               }|| _        y r5   )r   r9   rV  rI  r7   r	   rI  s      r8   r9   zLocaleTextCalendar.__init__i  &    dL1>(*Fr:   c                 z    t        | j                        5  t        |   ||      cd d d        S # 1 sw Y   y xY wr5   rG  rI  superr   )r7   r   r   	__class__s      r8   r   z LocaleTextCalendar.formatweekdayo  s*    dkk*7(e4 +**s   1:c                 ~    t        | j                        5  t        |   ||||      cd d d        S # 1 sw Y   y xY wr5   rG  rI  r]  r   )r7   r   r   r   r   r^  s        r8   r   z"LocaleTextCalendar.formatmonthnames  s.    dkk*7*7HeXN +**s   3<r   Nr  r?   r@   rA   r9   r   r   __classcell__r^  s   @r8   r   r   c  s    
5O Or:   r   c                   4     e Zd Z	 ddZ fdZd fd	Z xZS )r   c                 V    t         j                  | |       |
t               }|| _        y r5   )r   r9   rV  rI  rY  s      r8   r9   zLocaleHTMLCalendar.__init__}  rZ  r:   c                 x    t        | j                        5  t        |   |      cd d d        S # 1 sw Y   y xY wr5   r\  )r7   r   r^  s     r8   r   z LocaleHTMLCalendar.formatweekday  s(    dkk*7(- +**s   09c                 |    t        | j                        5  t        |   |||      cd d d        S # 1 sw Y   y xY wr5   r`  )r7   r   r   r   r^  s       r8   r   z"LocaleHTMLCalendar.formatmonthname  s,    dkk*7*7HhG +**s   2;ra  r  rb  rd  s   @r8   r   r   x  s    .H Hr:   r   c                 n    t         | cxk  rt        k  st        |        t        |       | t        _        y r5   )r,   r2   r   r  r	   r   s    r8   r   r     s1    \+V+!,// ,!,//!ANr:      rY   c                 2    	 t        t        | ||             y r5   )r   r  colsr	  spacings      r8   rm   rm     s    ;	,tXw
/0r:   c                 D    	 |dz  }|j                  fd| D              S )Nr   c              3   @   K   | ]  }|j                          y wr5   r   )r   r  r	  s     r8   r   zformatstring.<locals>.<genexpr>  s     9Dq*Dr2  r   rl  s    ` r8   r  r    s$    OsNG<<9D999r:   i  rL   c                     	 | d d \  }}}}}}t        j                  ||d      j                         t        z
  |z   dz
  }|dz  |z   }|dz  |z   }	|	dz  |z   }
|
S )NrY   rL      <   )r~   r   	toordinal
_EPOCH_ORD)tupler   r   r   hourminutesecondr   hoursminutessecondss              r8   r   r     su    L-22AY*D%dFF==ua(224zACG!KDGdNEBhGbj6!GNr:   c                    dd l }|j                         }|j                  d      }|j                  d      }|j                  ddt        dd       |j                  d	d
t        dd       |j                  ddt        dd       |j                  ddt        dd       |j                  dddd       |j                  ddd d       |j                  ddd d       |j                  d d!d"d#d$%       |j                  d&d't        d()       |j                  d*d't        d+)       |j                  | dd        }|j                  r2|j                  s&|j                  d,       t        j                  d       |j                  |j                  f}|j                  d-k(  r#|j                  rt        |.      }n
t               }|j                  }|t        j                         }t        ||j                   /      }	t        j"                  j$                  j&                  }
|j(                  @ |
 |j*                  t,        j.                  j1                         j(                  fi |	       y |j2                  $ |
 |j*                  |j(                  fi |	       y |j                  d0       t        j                  d       y |j                  rt5        |.      }n
t7               }t        |j8                  |j:                  1      }	|j2                  |j<                  |	d2<   |j>                  |	d3<   |j2                  tA        |j2                         |j(                  : |jB                  t,        j.                  j1                         j(                  fi |	}nR|j2                   |jB                  |j(                  fi |	}n( |jD                  |j(                  |j2                  fi |	}t        j"                  j&                  }
|j                  r?|jG                  |j                        }t        j"                  j$                  j&                  }
 |
|       y )4Nr   ztext only argumentszhtml only argumentsz-wz--widthrJ   z width of date column (default 2))typedefaulthelpz-lz--linesrL   z)number of lines for each week (default 1)z-sz	--spacingrY   z"spacing between months (default 6)z-mz--monthsrV   zmonths per row (default 3)z-cz--cssrE  zCSS to use for page)r  r  z-Lz--localez)locale to use for month and weekday namesz-ez
--encodingzencoding to use for outputz-tz--typetext)r  htmlzoutput type (text or html))r  choicesr  r   ?zyear number)nargsr~  r  r   zmonth number (1-12, text only)z/if --locale is specified --encoding is requiredr  rU  )rC  rB  zincorrect number of arguments)r   r   r  r   )$argparseArgumentParseradd_argument_groupadd_argumentint
parse_argsrI  rC  errorr?  exitr~  r   r   r@  dictrB  stdoutbufferwriter   rD  r~   r   todayr   r   r   r   linesrn  r   r   r  r   rA  )rQ  r  parser	textgroup	htmlgroupoptionsrI  r  rC  optdictr  results               r8   mainr    s   $$&F))*?@I))*?@Ii!/  
 i!8  
 k!1  
 j!)  
 g"  
 j8  
 l)  
 h )	     
 -   QR)G~~g..FG^^W---F||v>>$F3C.C##--/Hgkk:

!!''<<$#$$X]]%8%8%:%?%?K7KL]]"$#$$W\\=W=>LL89HHQK>>$F3C.C'--8== "??GCL">>GCL==$GMM*<<#S^^HMM$7$7$9$>$>J'JF]]"#S^^GLL<G<F$S__W\\7==LGLF

  ]]7#3#34FJJ%%++Efr:   __main__)Hr?  r~   enumr   r   rI  rL  	itertoolsr   rN   __all__
ValueErrorr  
IndexErrorr   r   rT   r   r   r   re   r   r   r   r   r   r
   r   r   r   r   r   r   r   objectr   r   r   rG  rV  r   r   r  r   r	   r   r   r   r   r   r  r   r   r   r   r   r  r   r  r   	_colwidth_spacingrm   r  EPOCHr   rt  ru  r   r  r?   argvrB   r:   r8   <module>r     s(  7   %   
! 	
@
J @X* X	K G    '   	< & ( $$ d#
d#
B
G:'?EJv EJPt<8 t<nF@8 F@R; ;O O*H H( N  "
 ##	
||

))	<<	 	 $X 1
 !*8 : 	X]]5!Q'113
gT zN r:   