+
    it  c                   sL   R t ^ RIt^ RIt^ RIHtHt ^ RIt^ RIH	t	 . RNRNRNRNRNR	NR
NRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNRNR NR!NR"NR#NR$NR%NR&NR'NR(NR)NR*NR+NR,NR-NR.NR/NR0Nt
]t ! R1 R]]4      t ! R2 R]4      tR3 t] ! R4 R]4      4       t] ! R5 R]4      4       t. RYOt ! R6 R74      t ! R8 R94      t]! R:4      t]! R;4      t]! R<4      t]! R=4      tR> tR? tR@ tRA tRB tRC tRD t RE t! ! RF R]"4      t# ! RG R]#4      t$ ! RH R]#4      t% ! RI RJ4      t&RK t' ! RL R]$4      t( ! RM R]%4      t) ! RN RO]$4      t* ! RP RQ](]*4      t+]$! 4       t,],PZ                  t.RR t/],P`                  t1],Pd                  t2],Pf                  t4],Pj                  t6],Pn                  t7],Pp                  t9],Pt                  t;],Px                  t=^t>^t?]>]?3RS lt@]>]?3RT ltARUtB]P                  ! ]B^^4      P                  4       tERV tFRZRW ltG]HRX8X  d
   ]G! 4        R# R# )[a$  Calendar printing functions

Note when comparing these calendars to the ones printed by cal(1): By
default, these calendars have Monday as the first day of the week, and
Sunday as the last (the European convention). Use setfirstweekday() to
set the first day of the week (0=Monday, 6=Sunday).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                   s,   a  ] tR t^ t o R tR tRtV tR# )r   c                    Wn         R # Nr   )selfr      &&!/usr/lib64/python3.14/calendar.py__init__ZIllegalMonthError.__init__!   s    
    c                (    R V P                   ,          # )z!bad month number %r; must be 1-12r2   r3      &r5   __str__ZIllegalMonthError.__str__#   s    2TZZ??r7   r2   N__name__
__module____qualname____firstlineno__r6   r;   __static_attributes____classdictcell____classdict__   @r5   r   r       s     @ @r7   c                   s,   a  ] tR t^'t o R tR tRtV tR# )r   c                r0   r1   r	   )r3   r	   r4   r5   r6   ZIllegalWeekdayError.__init__(   s    r7   c                r8   )z7bad weekday number %r; must be 0 (Monday) to 6 (Sunday)rF   r9   r:   r5   r;   ZIllegalWeekdayError.__str__*   s    H4<<WWr7   rF   Nr<   rC   rE   r5   r   r   '   s     X Xr7   c                 s    V R	9   d=   ^ RI pVP                  RV  RV P                  4        R2\        ^R7       V R 8X  d   ^# ^# \	        R\
         RV  R24      h)
JanuaryNzThe 'z ' attribute is deprecated, use 'z	' instead)Z
stacklevelzmodule 'z' has no attribute 'Z')rG   ZFebruary)warningsZwarnZupperZDeprecationWarningZAttributeErrorr=   )ZnamerH      & r5   __getattr__rJ   .   sf    &&dV#CDJJL>QZ[(Q 	 	89
8H:-A$qI
JJr7   c                   sF    ] tR t^<t^t^t^t^t^t^t	^t
^t^	t^
t^t^tRtR# )r    N)r=   r>   r?   r@   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   rA   rK   r7   r5   r   r   <   s>    GHEE
CDDFIGHHr7   c                   s2    ] tR t^Mt^ t^t^t^t^t^t	^t
RtR# )r   rK   N)r=   r>   r?   r@   r)   r*   r+   r,   r-   r.   r/   rA   rK   r7   r5   r   r   M   s%    FGIHFHFr7   c                   s   a ] tR t^`t o]! ^4       U u. uF,  p \
        P                  ! RV ^,           ^4      P                  NK.  	  up t]P                  ^ R 4       R t
R tR tRtVtR# u up i )_localized_month  c                s    R # ) rK   )Zxr:   r5   Z<lambda>Z_localized_month.<lambda>c   s    r7   c                r0   r1   formatr3   rP   r4   r5   r6   Z_localized_month.__init__e       r7   c                    V P                   V,          p\        V\        4      '       d"   V Uu. uF  q3! V P                  4      NK  	  up# V! V P                  4      # u upi r1   )_months
isinstanceslicerP   r3   iZfuncsZf   &&  r5   __getitem__Z_localized_month.__getitem__h   sM    Qa,12EqAdkkNE22%% 3   Ac                s    ^# )i   rK   r9   r:   r5   __len__Z_localized_month.__len__o   s    r7   rO   N)r=   r>   r?   r@   rangedatetimedatestrftimerT   Zinsertr6   rZ   r\   rA   rB   rX   rD      0@r5   rL   rL   `   s\     =B2YGYx}}T1Q3*33YGGNN1l#&  Hs   2A+rL   c            	       s   a ] tR t^st o]! ^4       U u. uF,  p \
        P                  ! R^V ^,           4      P                  NK.  	  up tR t	R t
R tRtVtR# u up i )_localized_dayrM   c                r0   r1   rO   rQ   r4   r5   r6   Z_localized_day.__init__x   rR   r7   c                rS   r1   )_daysrU   rV   rP   rW   rY   r5   rZ   Z_localized_day.__getitem__{   sM    

1a,12EqAdkkNE22%% 3r[   c                s    ^# i   rK   r9   r:   r5   r\   Z_localized_day.__len__   s    r7   rO   N)r=   r>   r?   r@   r]   r^   r_   r`   rd   r6   rZ   r\   rA   rB   ra   rb   r5   rc   rc   s   sQ      <A8D8aX]]4AaC(118DE&  Es   2Arc   z%Az%az%Bz%bc                sj    V ^,          ^ 8H  ;'       d!    V ^d,          ^ 8g  ;'       g    V R,          ^ 8H  # )z5Return True for leap years, False for non-leap years.  rK   )yearr:   r5   r   r      s0    !8q=AAdSjAo@@qAr7   c                s    V ^,          p V^,          pV^,          V ^,          ,
          V^d,          V ^d,          ,
          ,
          VR,          V R,          ,
          ,           # )z?Return number of leap years in range [y1, y2).
Assume y1 <= y2.rf   rK   )Zy1Zy2r4   r5   r   r      sL     !GB!GBEBEMb#gC/0BGb#g4EFFr7   c                s    \         P                  T u;8:  d   \         P                  8:  g   M RV R,          ,           p \        \         P                  ! WV4      P                  4       4      # )zBReturn weekday (0-6 ~ Mon-Sun) for year, month (1-12), day (1-31).i  rf   )r^   ZMINYEARZMAXYEARr   r_   r	   )rg   r   day   &&&r5   r	   r	      sH    t7x'7'77dSj x}}T#.66899r7   c                 s>    ^T u;8:  d   ^8:  g   M \        V 4      hR# )   N)r   r2   r:   r5   _validate_monthrk      s    && r7   c                s    \        V4       \        W^4      p\        V,          V\        8H  ;'       d    \	        V 4      ,           pW#3# )z`Return weekday of first day of month (0-6 ~ Mon-Sun)
and number of days (28-31) for year, month.)rk   r	   mdaysr   r   )rg   r   day1ndaysrY   r5   r
   r
      s?     E4"D%LEX->>&,?E;r7   c                 s^    \         V,          V\        8H  ;'       d    \        V 4      ,           # r1   )rl   r   r   rg   r   r4   r5   	_monthlenrp      s"    <5H,==>>r7   c                 s:    V^8X  d   V ^,
          ^3# W^,
          3# )rj   rK   ro   r4   r5   
_prevmonthrq      s#    zAvrz1W}r7   c                 s:    V^8X  d   V ^,           ^3# W^,           3# )i   rK   ro   r4   r5   
_nextmonthrr      s#    {Avqy1W}r7   c                   s   a  ] tR t^t o RtRR ltR tR t]! ]]4      t	R t
R tR tR tR	 tR
 tR tR tR tRR ltRR ltRR ltRtV tR# )r   zc
Base calendar class. This class doesn't do any formatting. It simply
provides data to subclasses.
c                r0   r1   r   r3   r   r4   r5   r6   ZCalendar.__init__   s    (r7   c                s(    V P                   ^,          # re   _firstweekdayr9   r:   r5   getfirstweekdayZCalendar.getfirstweekday   s    !!A%%r7   c                r0   r1   ru   rt   r4   r5   r   ZCalendar.setfirstweekday   s    )r7   c              #  s   "   \        V P                  V P                  ^,           4       F  pV^,          x  K  	  R# 5i)z\
Return an iterator for one week of weekday numbers starting with the
configured first one.
N)r]   r   )r3   rX   rI   r5   iterweekdaysZCalendar.iterweekdays   s3     
 t(($*;*;a*?@AA#I As   <>c              #  sv   "   V P                  W4       F  w  r4p\        P                  ! W4V4      x  K!  	  R# 5i)z
Return an iterator for one month. The iterator will yield datetime.date
values and will always iterate through complete weeks, so it will yield
dates outside the specified month.
N)itermonthdays3r^   r_   )r3   rg   r   ymd   &&&   r5   itermonthdatesZCalendar.itermonthdates   s1      **47GA!--a(( 8s   79c              #  s.  "   \        W4      w  r4W0P                  ,
          ^,          p\        ^ V4       Rj  xL
  \        ^V^,           4       Rj  xL
  V P                  V,
          V,
          ^,          p\        ^ V4       Rj  xL
  R#  LV L= L
5i)zn
Like itermonthdates(), but will yield day numbers. For days outside
the specified month the day number is 0.
N)r
   r   r   r]   )r3   rg   r   rm   rn   days_before
days_after   &&&    r5   itermonthdaysZCalendar.itermonthdays   s     
 !-///14![)))EAI&&&''$.6!;
!Z((( 	*&(s3   6BBBB4BB	BBBc              #  s   "   \        V P                  W4      V P                  4       F  w  r4WC^,          3x  K  	  R# 5i)z
Like itermonthdates(), but will yield (day number, weekday number)
tuples. For days outside the specified month the day number is 0.
N)	enumerater   r   )r3   rg   r   rX   r|      &&&  r5   itermonthdays2ZCalendar.itermonthdays2   s7     
 d00=t?P?PQDAU(N Rs   =?c              #  s  "   \        W4      w  r4W0P                  ,
          ^,          pV P                  V,
          V,
          ^,          p\        W4      w  rx\        Wx4      ^,           p	\	        W,
          V	4       F	  p
WxV
3x  K  	  \	        ^V^,           4       F	  p
WV
3x  K  	  \        W4      w  rx\	        ^V^,           4       F	  p
WxV
3x  K  	  R# 5i)zy
Like itermonthdates(), but will yield (year, month, day) tuples.  Can be
used for dates outside of datetime.date range.
N)r
   r   rq   rp   r]   rr   )r3   rg   r   rm   rn   r   r   rz   r{   endr|   s   &&&        r5   ry   ZCalendar.itermonthdays3   s     
 !-///14''$.6!;
$&o!s,A'M -q%!)$Aq.  %$&q*q.)A'M *s   CCc              #  s   "   \        V P                  W4      4       F'  w  pw  rEpWEW`P                  V,           ^,          3x  K)  	  R# 5i)z
Like itermonthdates(), but will yield (year, month, day, day_of_week) tuples.
Can be used for dates outside of datetime.date range.
N)r   ry   r   )r3   rg   r   rX   rz   r{   r|   r   r5   itermonthdays4ZCalendar.itermonthdays4
  sE     
 &d&9&9$&FGLAya--1Q666 Hs   AA
c                    \        V P                  W4      4      p\        ^ \        V4      ^4       Uu. uF  qCWD^,            NK  	  up# u upi )z
Return a matrix (list of lists) representing a month's calendar.
Each row represents a week; week entries are datetime.date values.
)listr~   r]   len)r3   rg   r   ZdatesrX   r   r5   monthdatescalendarZCalendar.monthdatescalendar  sF    
 T((56',QE
A'>@'>!q1'>@@@   A	c                r   )z
Return a matrix representing a month's calendar.
Each row represents a week; week entries are
(day number, weekday number) tuples. Day numbers outside this month
are zero.
)r   r   r]   r   r3   rg   r   daysrX   r   r5   monthdays2calendarZCalendar.monthdays2calendar  sF     D''45&+As4y!&<>&<a!&<>>>r   c                r   )zp
Return a matrix representing a month's calendar.
Each row represents a week; days outside this month are zero.
)r   r   r]   r   r   r   r5   monthdayscalendarZCalendar.monthdayscalendar$  sF    
 D&&t34&+As4y!&<>&<a!&<>>>r   c                    \          Uu. uF  q0P                  W4      NK  	  pp\        ^ \        V4      V4       Uu. uF  qTWUV,            NK  	  up# u upi u upi )z
Return the data for the specified year ready for formatting. The return
value is a list of month rows. Each month row contains up to width months.
Each month contains between 4 and 6 weeks and each week contains 1-7
days. Days are datetime.date objects.
)r   r   r]   r   r3   rg   widthr{   monthsrX   r}   r5   yeardatescalendarZCalendar.yeardatescalendar,  V     =BBEq))$2EB+0CK+GI+Gaq5!+GII CI
   AAc                r   )z
Return the data for the specified year ready for formatting (similar to
yeardatescalendar()). Entries in the week lists are
(day number, weekday number) tuples. Day numbers outside this month are
zero.
)r   r   r]   r   r   r}   r5   yeardays2calendarZCalendar.yeardays2calendar6  r   r   c                r   )z
Return the data for the specified year ready for formatting (similar to
yeardatescalendar()). Entries in the week lists are day numbers.
Day numbers outside this month are zero.
)r   r   r]   r   r   r}   r5   yeardayscalendarZCalendar.yeardayscalendar@  sV     <AA5a((15A+0CK+GI+Gaq5!+GII BIr   )rv   r   N)       )r=   r>   r?   r@   __doc__r6   rw   r   Zpropertyr   rx   r~   r   r   ry   r   r   r   r   r   r   r   rA   rB   rC   rE   r5   r   r      sm     
)&* O_=L)
)$7A??JJJ Jr7   c                   st   a  ] tR tRt o RtR tR tR tR tR t	RR lt
RR	 ltRR
 ltRR ltRR ltRtV tR# )r   iJ  zf
Subclass of Calendar that outputs a calendar as a simple plain text
similar to the UNIX program cal.
c                s>    \        V P                  W4      RR7       R# )z#
Print a single week (no newline).
rN   r   N)print
formatweekr3   theweekr   ri   r5   prweekZTextCalendar.prweekP  s     	doog-26r7   c                sJ    V^ 8X  d   RpM	RV,          pVP                  V4      # )z
Returns a formatted day.
rN   z%2icenter)r3   rh   r	   r   s   &&&& r5   	formatdayZTextCalendar.formatdayV  s'     !8AAxxr7   c                s>   a a RP                  V V3R lV 4       4      # )1
Returns a single week in a string (no newline).
 c              3   sL   <"   T F  w  rSP                  WS4      x  K  	  R # 5ir1   r   ).0r|   wdr3   r   s   &  r5   	<genexpr>Z*TextCalendar.formatweek.<locals>.<genexpr>d  s!     LG!qe44G   !$joinr   s   f&fr5   r   ZTextCalendar.formatweek`  s     xxLGLLLr7   c                s^    V^	8  d   \         pM\        pW1,          RV P                  V4      # )z$
Returns a formatted week day name.
N)r   r   r   )r3   rh   r   namess   &&& r5   formatweekdayZTextCalendar.formatweekdayf  s/     A:EEz&5!((//r7   c                sZ   a a RP                  V V3R lS P                  4        4       4      # )z
Return a header for a week.
r   c              3   sH   <"   T F  pSP                  VS4      x  K  	  R # 5ir1   r   )r   rX   r3   r   s   & r5   r   Z0TextCalendar.formatweekheader.<locals>.<genexpr>t  s#     R>Q**1e44>Qs   "r   rx   )r3   r   s   ffr5   formatweekheaderZTextCalendar.formatweekheaderp  s#     xxRd>O>O>QRRRr7   c                sv    \        V4       \        V,          pV'       d
   V: RV: 2pVP                  V4      # )z 
Return a formatted month name.
r   )rk   r   r   )r3   theyearthemonthr   withyearr   s   &&&&& r5   formatmonthnameZTextCalendar.formatmonthnamev  s1     	!x g&Axxr7   c                s@    \        V P                  WW44      RR7       R# )z
Print a month's calendar.
rN   r   N)r   formatmonth)r3   r   r   wls   &&&&&r5   r   ZTextCalendar.prmonth  s     	dw!7R@r7   c                s   \        ^V4      p\        ^V4      pV P                  W^V^,           ,          ^,
          4      pVP                  4       pVRV,          ,          pWPP                  V4      P                  4       ,          pVRV,          ,          pV P	                  W4       F8  pWPP                  Wc4      P                  4       ,          pVRV,          ,          pK:  	  V# )0
Return a month's calendar string (multi-line).

)maxr   rstripr   r   r   )r3   r   r   r   r   r   week   &&&&&  r5   r   ZTextCalendar.formatmonth  s     1I1I  AQK!ODHHJ	TAX	""1%,,..	TAX++G>D)0022AMA ? r7   c           	     s  a aaa \        ^V4      p\        ^V4      p\        ^V4      pV^,           ^,          ^,
          o. pVP                  pV! \        S4      P                  SV,          WE^,
          ,          ,           4      P	                  4       4       V! RV,          4       S P                  V4      o\        S P                  SV4      4       EFp  w  r\        WX,          ^,           \        WX^,           ,          ^,           ^4      4      p
V! RV,          4       VV V3R lV
 4       pV! \        VSV4      P	                  4       4       V! RV,          4       V3R lV
 4       pV! \        VSV4      P	                  4       4       V! RV,          4       \        R V	 4       4      p\        V4       F  p. pV	 FN  pV\        V4      8  d   VP                  R4       K&  VP                  S P                  VV,          V4      4       KP  	  V! \        VSV4      P	                  4       4       V! RV,          4       K  	  EKs  	  RP                  V4      # )3
Returns a year's calendar as a multi-line string.
r   c              3   L   <"   T F  pSP                  SVSR 4      x  K  	  R# 5iFNr   r   kcolwidthr3   r      & r5   r   *TextCalendar.formatyear.<locals>.<genexpr>  ,      &$ ))'1hFF$r   c              3   (   <"   T F  pSx  K	  	  R # 5ir1   rK   r   r   header   & r5   r   r          .v!vv   c              3   8   "   T F  p\        V4      x  K  	  R # 5ir1   r   r   calrI   r5   r   r          1ScSS   rN   )r   appendreprr   r   r   r   r   r]   minformatstringr   r   r   )r3   r   r   r   cr{   varX   rowr   r   headersheightjweeksr   r   r   s   ff&&&&           @@r5   
formatyearZTextCalendar.formatyear  s    1I1I1IEQ;?HH	$w-

xz!qS'1
2
9
9
;<	$q&	&&q)!$"8"8!"DEHQ13q5#a1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r7   c           	     sB    \        V P                  WW4V4      RR7       R# )zPrint a year's calendar.rN   r   N)r   r   )r3   r   r   r   r   r{   s   &&&&&&r5   pryearZTextCalendar.pryear  s    doog!2;r7   rK   NTr   r   i   rj      r   )r   r   r   r   )r=   r>   r?   r@   r   r   r   r   r   r   r   r   r   r   r   rA   rB   rC   rE   r5   r   r   J  sE     
7M0S	A $L< <r7   c                   s   a  ] tR tRt o Rt. ROt]tRtRtRt	Rt
RtR tR tR tR	 tRR
 ltRR ltRR ltRR ltRtV tR# )r   i  z,
This calendar returns complete HTML pages.
Znodayr   rg   c                sn    V^ 8X  d   RV P                   ,          # RV P                  V,          V3,          # )z
Return a day as a table cell.
z<td class="%s">&nbsp;</td>z<td class="%s">%d</td>)cssclass_noday
cssclasses)r3   rh   r	   ri   r5   r   ZHTMLCalendar.formatday  s5     !8/$2E2EEE+tw/G.MMMr7   c                sL   a  RP                  V 3R lV 4       4      pRV,          # )z(
Return a complete week as a table row.
rN   c              3   sJ   <"   T F  w  rSP                  W4      x  K  	  R # 5ir1   r   )r   r|   r   r3   s   &  r5   r   Z*HTMLCalendar.formatweek.<locals>.<genexpr>  s     AgqDNN1))s    #<tr>%s</tr>r   )r3   r   r   s   f& r5   r   ZHTMLCalendar.formatweek  s$     GGAAAq  r7   c                sP    RV P                   V,          : R\        V,          : R2# )z*
Return a weekday name as a table header.
z<th class="">z</th>)cssclasses_weekday_headr   )r3   rh   r4   r5   r   ZHTMLCalendar.formatweekday  s'    
 ((--x}}> 	>r7   c                sh   a  RP                  V 3R lS P                  4        4       4      pRV,          # )z,
Return a header for a week as a table row.
rN   c              3   sF   <"   T F  pSP                  V4      x  K  	  R # 5ir1   r   )r   rX   r3   r   r5   r   Z0HTMLCalendar.formatweekheader.<locals>.<genexpr>  s!     G3FaD&&q))3Fs   !r   r   )r3   r   s   f r5   r   ZHTMLCalendar.formatweekheader  s-     GGG43D3D3FGGq  r7   c                s    \        V4       V'       d   \        V,          : RV: 2pMR\        V,          ,          pRV P                  : RV: R2# )z%
Return a month name as a table row.
r   z%sz<tr><th colspan="7" class="r   z
</th></tr>)rk   r   cssclass_month_head)r3   r   r   r   r   r   r5   r   ZHTMLCalendar.formatmonthname  sF     	!%h//9Az(++A$$a) 	)r7   c                s   . pVP                   pV! RV P                  ,          4       V! R4       V! V P                  WVR7      4       V! R4       V! V P                  4       4       V! R4       V P	                  W4       F"  pV! V P                  V4      4       V! R4       K$  	  V! R4       V! R4       RP                  V4      # )z&
Return a formatted month as a table.
=<table border="0" cellpadding="0" cellspacing="0" class="%s">r   r   </table>rN   )r   cssclass_monthr   r   r   r   r   )r3   r   r   r   r   r   r   s   &&&&   r5   r   ZHTMLCalendar.formatmonth  s     HH	
I! 	"	$	$

w8

DE	$	$


!"	$++G>Ddood#$dG ? 	
*	$wwqzr7   c           
     s   . pVP                   p\        V^4      pV! RV P                  ,          4       V! R4       V! RW P                  V3,          4       \	        \
        \
        ^,           V4       Fa  p\	        V\        WR,           ^4      4      pV! R4       V F,  pV! R4       V! V P                  WRR7      4       V! R4       K.  	  V! R	4       Kc  	  V! R
4       RP                  V4      # )z/
Return a formatted year as a table of tables.
r   r   z,<tr><th colspan="%d" class="%s">%s</th></tr>z<tr>z<td>Fr   z</td>z</tr>r   rN   )	r   r   cssclass_yearcssclass_year_headr]   r   r   r   r   )r3   r   r   r   r   rX   r   r{   s   &&&     r5   r   ZHTMLCalendar.formatyear  s     HHE1	
I


 		$	
8**G<5 5 	6w
E2A1c!'2./FfI&	$""7">?'
  gJ 3 	
*wwqzr7   Nc                s   Vf   \         P                  ! 4       p. pVP                  pV! RV,          4       V! R4       V! R4       V! R4       V! RV,          4       Ve   V! RV,          4       V! RV,          4       V! R4       V! R	4       V! V P                  W4      4       V! R
4       V! R4       RP	                  V4      P                  VR4      # )z2
Return a formatted year as a complete HTML page.
z$<?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>
rN   Zxmlcharrefreplace)sysgetdefaultencodingr   r   r   encode)r3   r   r   cssencodingr   r   r   r5   formatyearpageZHTMLCalendar.formatyearpage3  s     --/HHH	
1H
<=	
{|	*	*	
PS[
[\?EKL	
,w
67	+	*	$//'
)*	+	+wwqz  +>??r7   rK   )ZmonZtueZwedZthuZfriZsatZsunr   r   )r   calendar.cssN)r=   r>   r?   r@   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rA   rB   rC   rE   r5   r   r     so     
 CJ ) N " N   MN!>!
)(0@ @r7   c                   s2   a  ] tR tRt o R tR tR tRtV tR# )different_localeiK  c                s     Wn         R V n        R # r1   locale	oldlocale)r3   r  r4   r5   r6   Zdifferent_locale.__init__L  s    r7   c                s    \         P                  ! \         P                  R 4      V n        \         P                  ! \         P                  V P                  4       R # r1   )_locale	setlocaleLC_TIMEr  r  r9   r:   r5   	__enter__Zdifferent_locale.__enter__P  s2     **7??DA'//4;;7r7   c                sd    \         P                  ! \         P                  V P                  4       R # r1   )r  r  r  r  )r3   argss   &*r5   __exit__Zdifferent_locale.__exit__T  s    '//4>>:r7   r   N)	r=   r>   r?   r@   r6   r  r  rA   rB   rC   rE   r5   r   r   K  s     8; ;r7   r   c                  s   \         P                  ! \         P                  R 4      p V R8X  dD   \        R4      ;_uu_ 4        \         P                  ! \         P                  R 4      p R R R 4       V # V #   + '       g   i     T # ; i)NZCrN   )r  r  r  r   r  s    r5   _get_default_localer
  X  sb    w5F}b!! &&w=F " M6M	 "! Ms    &A22B	c                   P   a a ] tR tRt oRtRR ltV 3R ltRV 3R lltRtVt	V ;t
# )	r   ib  |
This class can be passed a locale name in the constructor and will return
month and weekday names in the specified locale.
c                X    \         P                  W4       Vf   \        4       pW n        R # r1   )r   r6   r
  r  r3   r   r  ri   r5   r6   ZLocaleTextCalendar.__init__h  "    d1>(*Fr7   c                s   < \        V P                  4      ;_uu_ 4        \        SV `  W4      uuR R R 4       #   + '       g   i     R # ; ir1   r   r  superr   )r3   rh   r   	__class__s   &&&r5   r   Z LocaleTextCalendar.formatweekdayn  s.    dkk**7(4 +***	   9A
	c                s   < \        V P                  4      ;_uu_ 4        \        SV `  WW44      uuR R R 4       #   + '       g   i     R # ; ir1   r   r  r  r   )r3   r   r   r   r   r  s   &&&&&r5   r   Z"LocaleTextCalendar.formatmonthnamer  s0    dkk**7*7eN +***	   :A	r	  r   Nr   r=   r>   r?   r@   r   r6   r   r   rA   rB   __classcell__r  rD      @@r5   r   r   b  s      
5O Or7   c                   r  )	r   iw  r  c                r  r1   )r   r6   r
  r  r  ri   r5   r6   ZLocaleHTMLCalendar.__init__|  r  r7   c                s   < \        V P                  4      ;_uu_ 4        \        SV `  V4      uuR R R 4       #   + '       g   i     R # ; ir1   r  )r3   rh   r  s   &&r5   r   Z LocaleHTMLCalendar.formatweekday  s.    dkk**7(- +***r  c                s   < \        V P                  4      ;_uu_ 4        \        SV `  WV4      uuR R R 4       #   + '       g   i     R # ; ir1   r  )r3   r   r   r   r  s   &&&&r5   r   Z"LocaleHTMLCalendar.formatmonthname  s0    dkk**7*7hG +***r  r	  r  r   r  r  r  r5   r   r   w  s      .H Hr7   c                   sX   a a ] tR tRt oR	V 3R lltRR/R ltR
R ltRR ltRtVt	V ;t
# )_CLIDemoCalendari  Nc                4   < \         SV `  ! V/ VB  Wn        R # r1   r  r6   highlight_dayr3   r  r  Zkwargsr     &&*,r5   r6   Z_CLIDemoCalendar.__init__      $)&)*r7   r  c               s   a aaaa S'       d5   ^ RI Hp V! 4       pVP                   VP                   2oVP                  oMR;ooRP                  VVVV V3R lV 4       4      # )r   )
get_colorsrN   r   c              3   s   <"   T F8  w  rVS8X  d   S SP                  WS4       S 2MSP                  WS4      x  K:  	  R # 5ir1   r   )r   r|   r   	highlightr  resetr3   r   s   &  r5   r   Z._CLIDemoCalendar.formatweek.<locals>.<genexpr>  sT      
 # % +dnnQE:;E7C^^A512 #s   A A)Z	_colorizer"  ZBLACKZBACKGROUND_YELLOWZRESETr   )r3   r   r   r  r"  Zansir#  r$  s   f&fd  @@r5   r   Z_CLIDemoCalendar.formatweek  sc     ,<D::,t'='=&>?IJJE ""Ixx 
 
 #
 
 	
r7   c                s   V P                   '       dN   V P                   P                  V8X  d3   V P                   P                  V8X  d   V P                   P                  pMRp\	        ^V4      p\	        ^V4      pV P                  W^V^,           ,          ^,
          4      pVP                  4       pVRV,          ,          pW`P                  V4      P                  4       ,          pVRV,          ,          pV P                  W4       F:  pW`P                  WsVR7      P                  4       ,          pVRV,          ,          pK<  	  V# )r   Nr   r  )
r  rg   r   rh   r   r   r   r   r   r   )r3   r   r   r   r   r  r   r   s   &&&&&   r5   r   Z_CLIDemoCalendar.formatmonth  s
   
 ""''72""((H4 ..22M M1I1I  AQK!ODHHJ	TAX	""1%,,..	TAX++G>DFMMOOAMA ? r7   c                s  a aaa \        ^V4      p\        ^V4      p\        ^V4      pV^,           ^,          ^,
          o. pVP                  pV! \        S4      P                  SV,          WE^,
          ,          ,           4      P	                  4       4       V! RV,          4       S P                  V4      o\        S P                  SV4      4       EF  w  r\        WX,          ^,           \        WX^,           ,          ^,           ^4      4      p
V! RV,          4       VV V3R lV
 4       pV! \        VSV4      P	                  4       4       V! RV,          4       V3R lV
 4       pV! \        VSV4      P	                  4       4       V! RV,          4       S P                  '       d]   S P                  P                  S8X  dB   S P                  P                  V
9   d'   V
P                  S P                  P                  4      pMRp\        R V	 4       4      p\        V4       F  p. p\        V	4       Fr  w  ppV\        V4      8  d   VP                  R4       K)  VV8X  d   S P                  P                   MRpVP                  S P#                  VV,          VVR7      4       Kt  	  V! \        VSV4      P	                  4       4       V! RV,          4       K  	  EK  	  RP%                  V4      # )r   r   c              3   r   r   r   r   r   r5   r   ._CLIDemoCalendar.formatyear.<locals>.<genexpr>  r   r   c              3   r   r1   rK   r   r   r5   r   r&    r   r   Nc              3   r   r1   r   r   rI   r5   r   r&    r   r   rN   r%  )r   r   r   r   r   r   r   r   r]   r   r   r  rg   r   Zindexr   rh   r   r   )r3   r   r   r   r   r{   r   r   rX   r   r   r   r   Z	month_posr   r   r   r   r   rh   r   r   s   ff&&&&              @@r5   r   Z_CLIDemoCalendar.formatyear  s\    1I1I1IEQ;?HH	$w-

xz!qS'1
2
9
9
;<	$q&	&&q)!$"8"8!"DEHQ13q5#a1gai"45Fd1fI&$&El5(A.5578d1fI.v.Gl7Ha0779:d1fI """&&++w6&&,,6"LL););)A)AB	 	 1S11F6]'nFAsCH}R( 789nD..22$   OOCFASOI - ,uh299;<$( #/ FJ wwqzr7   r%  r1   r   r   )r=   r>   r?   r@   r6   r   r   r   rA   rB   r  r  r  r5   r  r    s%     +
$ 
,02 2r7   r  c                   s6   a a ] tR tRt oRV 3R lltRtVtV ;t# )_CLIDemoLocaleCalendari  c                r  r1   r  r  r   r5   r6   Z_CLIDemoLocaleCalendar.__init__  r!  r7   r%  r1   )r=   r>   r?   r@   r6   rA   rB   r  r  r  r5   r'  r'    s     + +r7   r'  c                 sd    \         T u;8:  d   \        8:  g   M \        V 4      hV \        n        R # r1   )r)   r/   r   r   r   rs   r:   r5   r   r     s!    \+V+!,//!ANr7   c                s0    \        \        WV4      4       R# )z1Prints multi-column formatting for year calendarsN)r   r   Zcolsr   spacingri   r5   rP   rP     s    	,tw
/0r7   c                sL   a VR,          pVP                  V3R lV  4       4      # )zEReturns a string formatted from n strings, centered within n columns.r   c              3   sD   <"   T F  qP                  S4      x  K  	  R # 5ir1   r   )r   r   r   r   r5   r   Zformatstring.<locals>.<genexpr>  s     9Dq**Ds    r   r(  s   &f&r5   r   r     s!    sNG<<9D999r7   i  c                s    V R,          w  rr4rV\         P                  ! W^4      P                  4       \        ,
          V,           ^,
          pV^,          V,           pV^<,          V,           p	V	^<,          V,           p
V
# )zBUnrelated but handy function to calculate Unix timestamp from GMT.:Nr   N)r^   r_   	toordinal
_EPOCH_ORD)Ztuplerg   r   rh   ZhourZminuteZsecondr   ZhoursZminutesZsecondss   &          r5   r   r   !  sh    -22Y*DF==a(224zACG!KDGdNEBhGbj6!GNr7   c                 sp	   ^ RI pVP                  RR7      pVP                  R4      pVP                  R4      pVP                  RR\        ^RR	7       VP                  R
R\        ^RR	7       VP                  RR\        ^RR	7       VP                  RR\        ^RR	7       VP                  RRRRR7       VP                  RRRRR7       VP                  RRRRR7       VP                  RRR R6R"R#7       VP                  R$R%\        ^ R&R	7       VP                  R'R(\        R)R*7       VP                  R+R(\        R,R*7       VP                  V 4      pVP                  '       d:   VP                  '       g(   VP                  R-4       \        P                  ! ^4       VP                  VP                  3p\        P                  P                  4       pVP                  R!8X  Ed5   VP                  '       d(   VP                  R.4       \        P                  ! ^4       VP                  '       d   \!        VR/7      pM
\#        4       pVP%                  VP&                  4       VP                  p	V	f   \        P(                  ! 4       p	\+        WP,                  R07      p
\        P.                  P0                  P2                  pVP4                  f&   V! VP6                  ! VP4                  3/ V
B 4       R# V! VP6                  ! VP4                  3/ V
B 4       R# VP                  '       d   \9        WvR17      pM\;        VR27      pVP%                  VP&                  4       \+        VP<                  VP>                  R37      p
VP                  f    VP@                  V
R4&   VPB                  V
R5&   M\E        VP                  4       VP4                  f   VPF                  ! VP4                  3/ V
B pMTVP                  f   VPF                  ! VP4                  3/ V
B pM(VPH                  ! VP4                  VP                  3/ V
B p\        P.                  P2                  pVP                  '       d@   VPK                  VP                  4      p\        P.                  P0                  P2                  pV! V4       R# )7r   NT)Zcolorztext only argumentszhtml only argumentsz-wz--widthz width of date column (default 2))typedefaulthelpz-lz--linesz)number of lines for each week (default 1)z-sz	--spacingz"spacing between months (default 6)z-mz--monthszmonths per row (default 3)z-cz--cssr   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htmlzoutput type (text or html))r-  Zchoicesr.  z-fz--first-weekdayzAweekday (0 is Monday, 6 is Sunday) to start each week (default 0)rg   Z?zyear number)Znargsr,  r.  r   zmonth number (1-12, text only)z/if --locale is specified --encoding is requiredzincorrect number of argumentsr	  )r   r   )r  r  r%  )r   r   r   r{   )r/  r0  )&argparseZArgumentParserZadd_argument_groupZadd_argumentZintZ
parse_argsr  r   errorr   Zexitr^   r_   todayr,  r   r   r   r   Zfirst_weekdayr   Zdictr   ZstdoutZbufferwriterg   r   r'  r  r   Zlinesr)  r   rk   r   r   r   )r  r1  ZparserZ	textgroupZ	htmlgroupZoptionsr  r3  r   r   Zoptdictr4  Zresults   &            r5   mainr5  +  s   $$4$0F))*?@I))*?@Ii!/  
 i!8  
 k!1  
 j!)  
 g"  
 j8  
 l)  
 h )	   !P  
   
 -   %G~~~g...FG^^W---FMM!E||v===LL89HHQK>>>$F3C.CG112##--/Hkk:

!!''<<#$$UZZ;7;<#$$W\\=W=>>>>(uLC"7CG112'--8== "??GCL">>GCLGMM*<<^^EJJ:':F]]"^^GLL<G<F__W\\7==LGLF

  ]]7#3#34FJJ%%++Efr7   Z__main__)r      i   r6     r6  r7  r6  r6  r7  r6  r7  r6  r1   )Ir   r   r^   Zenumr    r   r  r  Z	itertoolsr   Z__all__Z
ValueErrorr2  Z
IndexErrorr   r   rJ   r   r   rl   rL   rc   r   r   r   r   r   r   r	   rk   r
   rp   rq   rr   Zobjectr   r   r   r   r
  r   r   r  r'  r   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Z	_colwidthZ_spacingrP   r   ZEPOCHr_   r*  r+  r   r5  r=   rK   r7   r5   <module>r8     s  7   %  
! 
! 5 
!7H 
!
!#
!%/
!1:
!<H
!
!%
!'.
!07
!9C
! 
! "
! $0
! 2<
! >H
! 	
! &	
! (6	
! 8L	
!
  
!
 ".
! 
! 
! %
! '1
! 3:
! 
! 
! "
! $*
! 
! !
! #,
! .8
! :D
! 
! 
! !,
! .8
! :B
! 
!  
! 	
@
J @X* X
K G    '   	< & ( $$ d#
d#
B
G:'?EJv EJPu<8 u<pF@8 F@R
; 
;O O*H H(e| eP+/1A + N  "
 ##	
||

))	<<	 	 $X 1
 !*8 : 	]]5!Q'113
od zF r7   