
    z%iSc                     r   	 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      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 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(jR                  Z*d+ Z+e(jX                  Z-e(j\                  Z.e(j^                  Z0e(jb                  Z2e(jf                  Z3e(jh                  Z5e(jl                  Z7e(jp                  Z9d,Z:d-Z;e:e;fd.Z<e:e;fd/Z=d0Z> ej~                  e>d1d1      j                         ZAd2 ZBd3 ZCeDd4k(  r eCe j                         yy)5    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     </home/uftp/.pyenv/versions/3.12.0/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   K   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>a   s    r:   c                     || _         y r5   formatr7   rm   s     r8   r9   z_localized_month.__init__c   	    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__f   sF    Qa,12qAdkkN22%% 3   Ac                      y)N   rB   r<   s    r8   __len__z_localized_month.__len__m   s    r:   N)r?   r@   rA   rangedatetimedatestrftimerq   insertr9   rx   r|   .0ru   r~   s   000r8   re   re   ^   sS    =B2YGGx}}T1Q3*33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__v   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__y   sF    

1a,12qAdkkN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   q   sH     <A8DDaX]]4AaC(11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                     	 d|cxk  rdk  st        |       t        |      t        | |d      }t        |   |t        k(  xr t	        |       z   }||fS NrL   r_   )r   r   mdaysr!   r
   )r   r   day1ndayss       r8   r   r      sc    && &&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   s=     	 t(($*;*;a*?@ 	AA#I	s   24c              #   v   K   	 | j                  ||      D ]  \  }}}t        j                  |||       ! y wr5   )itermonthdays3r~   r   )r7   r   r   ymds         r8   itermonthdateszCalendar.itermonthdates   sB     	
 **47 	)GAq!--1a((	)s   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   sG     	 d00u=t?P?PQ 	DAqQU(N	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  sW     	 &d&9&9$&FG 	7LAy1aQD--1Q666	7s   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  sK    	 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  sK    	 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  sK    	 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'  \    	 =BBq$))$2BB+0CK+GIaq5!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.yeardays2calendar1  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;  s\    	
 <AAa$((q1AA+0CK+GIaq5!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.prweekK  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.formatdayQ  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>_  s"     L!Rq"e4Ls    #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.formatweekdaya  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>o  s     R**1e4Rs   r   r   )r7   r   s   ``r8   formatweekheaderzTextCalendar.formatweekheaderk  s(    	 xxRd>O>O>QRRRr:   c                 J    	 t         |   }|r|d|}|j                  |      S )Nr   )r   r   )r7   theyearthemonthr   withyearr   s         r8   formatmonthnamezTextCalendar.formatmonthnameq  s.    	 x g&Axxr:   c                 D    	 t        | j                  ||||      d       y r   )r   formatmonth)r7   r   r   wls        r8   r   zTextCalendar.prmonthz  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.s   c              3   2   K   | ]  }t        |        y wr5   )r   )r   cals     r8   r   z*TextCalendar.formatyear.<locals>.<genexpr>  s     1cS1s   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E 	HQ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]  ACCH}R(T__SVQ%?@	A
 ,uh299;<$(	, 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   E  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      Agq"DNN1b)As   "<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     GaD&&q)G   r*  r   )r7   r   s   ` r8   r   zHTMLCalendar.formatweekheader  s2    	 GGG43D3D3FGGq  r:   c                 d    	 |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   cssclass_month_head)r7   r   r   r   r   s        r8   r   zHTMLCalendar.formatmonthname  s@    	 %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   r4  r   z,<tr><th colspan="%d" class="%s">%s</th></tr>r_   r{   z<tr>z<td>Fr5  z</td>z</tr>r6  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2 	A1c!E'2./FfI &	$""7A">?'
 gJ	 	
*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.formatyearpage*  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&  r2  r7  r:  r9  r   r   r   r   r   r   r  rB  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   rG  s     r8   r9   zdifferent_locale.__init__C  s    r:   c                     t        j                  t         j                  d       | _        t        j                  t         j                  | j                         y r5   )_locale	setlocaleLC_TIMErH  rG  r<   s    r8   	__enter__zdifferent_locale.__enter__G  s2     **7??DA'//4;;7r:   c                 z    | j                   y t        j                  t        j                  | j                          y r5   )rH  rJ  rK  rL  )r7   argss     r8   __exit__zdifferent_locale.__exit__K  s'    >>!'//4>>:r:   N)r?   r@   rA   r9   rM  rP  rB   r:   r8   rE  rE  B  s    8;r:   rE  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   )rJ  rK  rL  rE  rG  s    r8   _get_default_localerT  Q  sa    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   rT  rG  r7   r	   rG  s      r8   r9   zLocaleTextCalendar.__init__a  &    dL1>(*Fr:   c                 z    t        | j                        5  t        |   ||      cd d d        S # 1 sw Y   y xY wr5   rE  rG  superr   )r7   r   r   	__class__s      r8   r   z LocaleTextCalendar.formatweekdayg  s3    dkk* 	57(e4	5 	5 	5s   1:c                 ~    t        | j                        5  t        |   ||||      cd d d        S # 1 sw Y   y xY wr5   rE  rG  r[  r   )r7   r   r   r   r   r\  s        r8   r   z"LocaleTextCalendar.formatmonthnamek  s;    dkk* 	O7*7HeXN	O 	O 	Os   3<r   Nr  r?   r@   rA   r9   r   r   __classcell__r\  s   @r8   r   r   [  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   rT  rG  rW  s      r8   r9   zLocaleHTMLCalendar.__init__u  rX  r:   c                 x    t        | j                        5  t        |   |      cd d d        S # 1 sw Y   y xY wr5   rZ  )r7   r   r\  s     r8   r   z LocaleHTMLCalendar.formatweekday{  s1    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  s9    dkk* 	H7*7HhG	H 	H 	Hs   2;r_  r  r`  rb  s   @r8   r   r   p  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     9q*9r0  r   rj  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                 n   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<   |j(                  : |j@                  t,        j.                  j1                         j(                  fi |	}nR|j2                   |j@                  |j(                  fi |	}n( |jB                  |j(                  |j2                  fi |	}t        j"                  j&                  }
|j                  r?|jE                  |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--cssrC  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 (1-9999))nargsr|  r~  r   zmonth number (1-12, text only)z/if --locale is specified --encoding is requiredr  rS  )rA  r@  zincorrect number of arguments)r   r   r  r   )#argparseArgumentParseradd_argument_groupadd_argumentint
parse_argsrG  rA  errorr=  exitr|  r   r   r>  dictr@  stdoutbufferwriter   rB  r~   r   todayr   r   r   r   linesrl  r   r  r   r?  )rO  r  parser	textgroup	htmlgroupoptionsrG  r  rA  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<<#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__)Fr=  r~   enumr   r   rG  rJ  	itertoolsr   rN   __all__
ValueErrorr  r   r   rT   r   r   r   re   r   r   r   r   r   r
   r   r   r   r   r   r   objectr   r   r   rE  rT  r   r   r  r   r	   r   r   r   r   r   r  r   r   r   r   r   r  r   r  r   	_colwidth_spacingrm   r  EPOCHr   rr  rs  r   r  r?   argvrB   r:   r8   <module>r     s!  7   %   
! 	@
 @X* X	K G    '   	< & ( $$ d#
d#
B
G:?EJv EJPr<8 r<jE@8 E@P; ;O O*H H( N  "
 ##	
||

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