eehSrSSKrSSKrSSKJrJr SSKrSSKJ r /SQr \ r "SS\ \ 5r"SS \ 5rS r\"S S \55r\"S S\55r/SQr"SS5r"SS5r\"S5r\"S5r\"S5r\"S5rSrSrSrSrSrSrSr Sr!"S S!\"5r#"S"S#\#5r$"S$S%\#5r%"S&S'5r&S(r'"S)S*\$5r("S+S,\%5r)\$"5r*\*RVr,S-r-\*R\r/\*R`r0\*Rbr2\*Rfr4\*Rjr5\*Rlr7\*Rpr9\*Rtr;S.r\<\=4S1jr?S2r@\R"\@S3S35R5rCS4rDS7S5jrE\FS6:Xa\E"5 gg)8a$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)-IllegalMonthErrorIllegalWeekdayErrorsetfirstweekday firstweekdayisleapleapdaysweekday monthrange monthcalendarprmonthmonthprcalcalendartimegm month_name month_abbrday_nameday_abbrCalendar TextCalendar HTMLCalendarLocaleTextCalendarLocaleHTMLCalendar weekheaderDayMonthJANUARYFEBRUARYMARCHAPRILMAYJUNEJULYAUGUST SEPTEMBEROCTOBERNOVEMBERDECEMBERMONDAYTUESDAY WEDNESDAYTHURSDAYFRIDAYSATURDAYSUNDAYc \rSrSrSrSrSrg)r cXlgNr)selfrs ./opt/imh/python3.13/lib/python3.13/calendar.py__init__IllegalMonthError.__init__!s c SUR-$)Nz!bad month number %r; must be 1-12r7r8s r9__str__IllegalMonthError.__str__#s2TZZ??r<r7N__name__ __module__ __qualname____firstlineno__r:r?__static_attributes__r<r9rr s @r<rc \rSrSrSrSrSrg)r'cXlgr6r )r8r s r9r:IllegalWeekdayError.__init__(s r<c SUR-$)Nz7bad weekday number %r; must be 0 (Monday) to 6 (Sunday)rKr>s r9r?IllegalWeekdayError.__str__*sH4<<WWr<rKNrArGr<r9rr's Xr<rcUS;a6SSKnURSUSUR5S3[SS9 US:Xag g[ S [ S US 35e) N)JanuaryFebruaryrzThe 'z ' attribute is deprecated, use 'z ' instead) stacklevelrPzmodule 'z' has no attribute '')warningswarnupperDeprecationWarningAttributeErrorrB)namerVs r9 __getattr__r\.sf && dV#CDJJL>QZ[(Q  8 9  8H:-A$qI JJr<cD\rSrSrSrSrSrSrSrSr Sr S r S r S r S rS rSrg)r<rTrR rGN)rBrCrDrEr r!r"r#r$r%r&r'r(r)r*r+rFrGr<r9rr<s>GH E E C D D FIGHHr<rc0\rSrSrSrSrSrSrSrSr Sr S r g ) rMrrTrRr_r`rarbrGN) rBrCrDrEr,r-r.r/r0r1r2rFrGr<r9rrMs% FGIH FH Fr<r) rrkrkrmrkrkrmrkrmrkc \rSrSr\"S5VVVs/sH(n[ R "SUS-S5RPM* snnnr\RSS5 Sr Sr S r S r g s snnnf) _localized_month`rhrTrcg)NrG)xs r9_localized_month.csr<cXlgr6formatr8rys r9r:_localized_month.__init__e r<cURUn[U[5(a"UVs/sHo3"UR5PM sn$U"UR5$s snfr6)_months isinstancesliceryr8ifuncsfs r9 __getitem___localized_month.__getitem__hsM Q a  ,12EqAdkkNE2 2% %3Acg)N rGr>s r9__len___localized_month.__len__osr<rxN)rBrCrDrErangedatetimedatestrftimer~insertr:rrrF.0rrs000r9roro`sT=B2YGYx}}T1Q3*33YGG NN1l#&Hs/A&roc \rSrSr\"S5VVVs/sH(n[ R "SSUS-5RPM* snnnrSr Sr Sr Sr g s snnnf) _localized_daysrcrqrTcXlgr6rxrzs r9r:_localized_day.__init__xr|r<cURUn[U[5(a"UVs/sHo3"UR5PM sn$U"UR5$s snfr6)_daysrrryrs r9r_localized_day.__getitem__{sM 1  a  ,12EqAdkkNE2 2% %3rcgNrcrGr>s r9r_localized_day.__len__sr<rxN) rBrCrDrErrrrrr:rrrFrs000r9rrssI&, ?E ;r<cL[UU[:H=(a [U5-$r6)rr!r rrs r9 _monthlenrs <5H,= >>r<c(US:XaUS- S4$XS- 4$rrGrs r9 _prevmonthrs# zAvrz1W}r<c(US:XaUS-S4$XS-4$)NrhrTrGrs r9 _nextmonthrs# {Avqy1W}r<c\rSrSrSrSSjrSrSr\"\\5r Sr Sr Sr S r S rS rS rS rSrSSjrSSjrSSjrSrg)rzc Base calendar class. This class doesn't do any formatting. It simply provides data to subclasses. cXlgr6r r8r s r9r:Calendar.__init__s(r<c URS-$r _firstweekdayr>s r9getfirstweekdayCalendar.getfirstweekdays!!A%%r<cXlgr6rrs r9rCalendar.setfirstweekdays)r<c#n# [URURS-5H nUS-v M g7f)z\ Return an iterator for one week of weekday numbers starting with the configured first one. rcN)rr )r8rs r9 iterweekdaysCalendar.iterweekdayss3 t(($*;*;a*?@AA#IAs35c#t# URX5Hup4n[R"X4U5v M! g7f)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)itermonthdays3rr)r8rrymds r9itermonthdatesCalendar.itermonthdatess1 **47GA!--a( (8s68c## [X5up4X0R- S-n[SU5ShvN [SUS-5ShvN URU- U- S-n[SU5ShvN gNEN0N 7f)zn Like itermonthdates(), but will yield day numbers. For days outside the specified month the day number is 0. rcrNrT)r r rr)r8rrrr days_before days_afters r9 itermonthdaysCalendar.itermonthdayss !- ///14 ![)))EAI&&&''$.6!; !Z((( *&(s3.A<A6A<A8(A<0A:1A<8A<:A<c#x# [URX5UR5H up4XCS-4v M g7f)z Like itermonthdates(), but will yield (day number, weekday number) tuples. For days outside the specified month the day number is 0. rcN) enumeraterr )r8rrrrs r9itermonthdays2Calendar.itermonthdays2s7 d00=t?P?PQDAU(NRs8:c#h# [X5up4X0R- S-nURU- U- S-n[X5upx[Xx5S-n [ X- U 5H n XxU 4v M [ SUS-5H n XU 4v M [ X5upx[ SUS-5H n XxU 4v M g7f)zy Like itermonthdates(), but will yield (year, month, day) tuples. Can be used for dates outside of datetime.date range. rcrTN)r r rrrr) r8rrrrrrrrendrs r9rCalendar.itermonthdays3s !- ///14 ''$.6!; $&o!s,A'M-q%!)$Aq. %$&q*q.)A'M*sB0B2c## [URX55HunupEnXEX`RU-S-4v M! g7f)z Like itermonthdates(), but will yield (year, month, day, day_of_week) tuples. Can be used for dates outside of datetime.date range. rcN)rrr )r8rrrrrrs r9itermonthdays4Calendar.itermonthdays4 sE &d&9&9$&FGLAya--1Q66 6Hs?Ac[URX55n[S[U5S5Vs/sH oCXDS-PM sn$s snf)z Return a matrix (list of lists) representing a month's calendar. Each row represents a week; week entries are datetime.date values. rrc)listrrlen)r8rrdatesrs r9monthdatescalendarCalendar.monthdatescalendarsF T((56',QE A'>@'>!q1'>@@@Ac[URX55n[S[U5S5Vs/sH oCXDS-PM sn$s snf)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. rrc)rrrrr8rrdaysrs r9monthdays2calendarCalendar.monthdays2calendarsFD''45&+As4y!&<>&<a!&<>>>rc[URX55n[S[U5S5Vs/sH oCXDS-PM sn$s snf)zp Return a matrix representing a month's calendar. Each row represents a week; days outside this month are zero. rrc)rrrrrs r9monthdayscalendarCalendar.monthdayscalendar$sF D&&t34&+As4y!&<>&<a!&<>>>rc[Vs/sHo0RX5PM nn[S[U5U5Vs/sH oTXUU-PM sn$s snfs snf)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)rrrrr8rwidthrmonthsrs r9yeardatescalendarCalendar.yeardatescalendar,V=BBEq))$2EB+0CK+GI+Gaq5!+GIICI AAc[Vs/sHo0RX5PM nn[S[U5U5Vs/sH oTXUU-PM sn$s snfs snf)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)rrrrrs r9yeardays2calendarCalendar.yeardays2calendar6rrc[Vs/sHo0RX5PM nn[S[U5U5Vs/sH oTXUU-PM sn$s snfs snf)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)rrrrrs r9yeardayscalendarCalendar.yeardayscalendar@sV ^^SRUU4SjU55$)z1 Returns a single week in a string (no newline).  c3L># UHupTRXT5v M g7fr6r )rrwdr8rs r9 *TextCalendar.formatweek..ds!LG!qe44G!$joinrs` `r9rTextCalendar.formatweek`sxxLGLLLr<cTUS:a[nO[nX1SURU5$)z$ Returns a formatted week day name. reN)rrr)r8rrnamess r9 formatweekdayTextCalendar.formatweekdayfs/ A:EEz&5!((//r<cZ^^SRUU4SjTR555$)z Return a header for a week. r c3H># UHnTRUT5v M g7fr6r)rrr8rs r9r0TextCalendar.formatweekheader..ts#R>Q**1e44>Qs"rr)r8rs``r9formatweekheaderTextCalendar.formatweekheaderps#xxRd>O>O>QRRRr<cl[U5 [UnU(a U<SU<3nURU5$)z Return a formatted month name. r )rrr)r8theyearthemonthrwithyearr s r9formatmonthnameTextCalendar.formatmonthnamevs1 ! x  g&Axxr<c8[URXX45SS9 g)z Print a month's calendar. rsrN)r formatmonth)r8r#r$wls r9rTextCalendar.prmonths dw!7R@r<cp[SU5n[SU5nURXSUS--S- 5nUR5nUSU-- nXPRU5R5- nUSU-- nUR X5H,nXPR Xc5R5- nUSU-- nM. U$)z0 Return a month's calendar string (multi-line). rRrTrc )maxr&rstripr rr)r8r#r$r*r+r weeks r9r)TextCalendar.formatmonths 1I 1I  AQK!O D HHJ TAX  " "1 % , , .. TAX ++G>D )002 2A MA?r<c ^^^^[SU5n[SU5n[SU5nUS-S-S- m/nURnU"[T5RTU-XES- --5R 55 U"SU-5 TR U5m[ TRTU55GHGup[XX-S-[XXS--S-S55n U"SU-5 UUU4SjU 5n U"[U TU5R 55 U"SU-5 U4SjU 5n U"[U TU5R 55 U"SU-5 [SU 55n [U 5Hn/nU HInU[U5:aURS 5 M%URTRUUU55 MK U"[UTU5R 55 U"SU-5 M GMJ S RU5$) z3 Returns a year's calendar as a multi-line string. rRrTrcr.rc3L># UHnTRTUTS5v M g7f)FN)r&)rkcolwidthr8r#s r9r*TextCalendar.formatyear..s,&$))'1hFF$rc3(># UHnTv M g7fr6rG)rr5headers r9rr7s.v!vvsc38# UHn[U5v M g7fr6)r)rcals r9rr7s1ScSSsrs)r/appendreprrr0r rrrmin formatstringrrr)r8r#r*r+crvarrowrrheadersheightjweeksr;r6r9s`` @@r9 formatyearTextCalendar.formatyears 1I 1I 1IEQ;?  HH $w-  xz!qS'1 2 9 9 ;< $q& &&q)!$"8"8!"DEHQ13q5#a1gai"45F d1fI&$&E l5(A.557 8 d1fI.v.G l7Ha0779 : d1fI1S11F6]CCH} R( T__SVQ%?@  ,uh299;<$( #F,wwqzr<c :[URXX4U5SS9 g)zPrint a year's calendar.rsrN)rrH)r8r#r*r+r@rs r9pryearTextCalendar.pryears doog!2;r<rGNT)rr)rRrTrbr_)rrrbr_)rBrCrDrErrr rrr r&rr)rHrKrFrGr<r9rrJs= 7 M 0S A  #J z%d)cssclass_noday cssclasses)r8rr s r9r HTMLCalendar.formatdays5 !8/$2E2EE E+tw/G.MM Mr<cD^SRU4SjU55nSU-$)z( Return a complete week as a table row. rsc3J># UHupTRX5v M g7fr6r)rrrr8s r9r*HTMLCalendar.formatweek..sAgqDNN1))s # %sr)r8rr s` r9rHTMLCalendar.formatweeks$ GGAA Aq  r<c@SURU<S[U<S3$)z* Return a weekday name as a table header. z z)cssclasses_weekday_headr)r8rs r9rHTMLCalendar.formatweekdays"  ( ( -x}> >r<c`^SRU4SjTR555nSU-$)z, Return a header for a week as a table row. rsc3F># UHnTRU5v M g7fr6r)rrr8s r9r0HTMLCalendar.formatweekheader..s!G3FaD&&q))3Fs!r^r)r8r s` r9r HTMLCalendar.formatweekheaders- GGG43D3D3FG Gq  r<c[U5 U(a[U<SU<3nO S[U-nSUR<SU<S3$)z% Return a month name as a table row. r z%szr.r%rs)r<cssclass_monthr&r rrr)r8r#r$r%rArBr1s r9r)HTMLCalendar.formatmonths  HH I    ! " $ $  w8  DE $ $   !" $++G>D dood# $ dG? *  $wwqzr<c /nURn[US5nU"SUR-5 U"S5 U"SX RU4-5 [ [ [ S-U5HZn[ U[ XR-S55nU"S5 UH)nU"S5 U"URXS S 95 U"S 5 M+ U"S 5 M\ U"S 5 SRU5$)z/ Return a formatted year as a table of tables. rTrlr.z,%srhrzzFrmzzrnrs) r<r/ cssclass_yearcssclass_year_headrr r>r)r)r8r#rrArBrrrs r9rHHTMLCalendar.formatyears  HHE1  I      $ 8 **G<5 5 6w E2A1c!'2./F fI& $""7">?'  gJ3 * wwqzr<NcUc[R"5n/nURnU"SU-5 U"S5 U"S5 U"S5 U"SU-5 Ub U"SU-5 U"SU-5 U"S5 U"S 5 U"URX55 U"S 5 U"S 5 S R U5R US 5$)z2 Return a formatted year as a complete HTML page. z$ zn z z zC z4 zCalendar for %d z z z z rsxmlcharrefreplace)sysgetdefaultencodingr<rHrencode)r8r#rcssencodingrArBs r9formatyearpageHTMLCalendar.formatyearpage2s  --/H  HH 1H <= {| *  *  PS[ [\ ? EK L ,w 67 + *  $//' )* + +wwqz  +>??r<rGrMr)r_ calendar.cssN)rBrCrDrErrYrbrXrirorsrrr rrr r&r)rHr|rFrGr<r9rrsf CJ)N"N MN!>! )(0@r<rc&\rSrSrSrSrSrSrg)different_localeiJcXlSUlgr6locale oldlocale)r8rs r9r:different_locale.__init__Ks r<c[R"[RS5Ul[R"[RUR5 gr6)_locale setlocaleLC_TIMErrr>s r9 __enter__different_locale.__enter__Os2 **7??DA'//4;;7r<cb[R"[RUR5 gr6)rrrr)r8argss r9__exit__different_locale.__exit__Ss'//4>>:r<rN)rBrCrDrEr:rrrFrGr<r9rrJs8;r<rc[R"[RS5nUS:Xa;[S5 [R"[RS5nSSS5 U$U$!,(df  U$=f)NCrs)rrrrrs r9_get_default_localerWs_   w 5F } b !&&w=F" M6M " ! Ms &A)) A8cF^\rSrSrSrSSjrU4SjrSU4SjjrSrU=r $) ria| This class can be passed a locale name in the constructor and will return month and weekday names in the specified locale. cT[RX5 Uc [5nX lgr6)rr:rrr8r rs r9r:LocaleTextCalendar.__init__g"d1 >(*F r<c>[UR5 [TU] X5sSSS5 $!,(df  g=fr6rrsuperr)r8rr __class__s r9r LocaleTextCalendar.formatweekdayms( dkk *7(4+ * *0 >c>[UR5 [TU] XX45sSSS5 $!,(df  g=fr6rrrr&)r8r#r$rr%rs r9r&"LocaleTextCalendar.formatmonthnameqs* dkk *7*7eN+ * *1 ?rrNrM rBrCrDrErr:rr&rF __classcell__rs@r9rras  5OOr<rcF^\rSrSrSrSSjrU4SjrSU4SjjrSrU=r $) rivrcT[RX5 Uc [5nX lgr6)rr:rrrs r9r:LocaleHTMLCalendar.__init__{rr<c>[UR5 [TU] U5sSSS5 $!,(df  g=fr6r)r8rrs r9r LocaleHTMLCalendar.formatweekdays( dkk *7(-+ * *rc>[UR5 [TU] XU5sSSS5 $!,(df  g=fr6r)r8r#r$r%rs r9r&"LocaleHTMLCalendar.formatmonthnames* dkk *7*7hG+ * *rrrrMrrs@r9rrvs .HHr<rc^[Us=::a [::d O [U5eU[lgr6)r,r2rr@r rs r9rrs! \ +V +!,//!ANr<rbc.[[XU55 g)z1Prints multi-column formatting for year calendarsN)rr?colsr6spacings r9ryrys ,tw /0r<cD^US-nURU4SjU55$)zEReturns a string formatted from n strings, centered within n columns.r c3D># UHoRT5v M g7fr6r)rr@r6s r9rformatstring..s9Dq**Ds rrs ` r9r?r?s! sNG <<9D9 99r<irTcUSSupp4pV[R"XS5R5[- U-S- nUS-U-nUS-U-n U S-U-n U $)zBUnrelated but handy function to calculate Unix timestamp from GMT.NrbrTr^)rr toordinal _EPOCH_ORD) tuplerrrhourminutesecondrhoursminutessecondss r9rrsj-22AY*DF ==a ( 2 2 4z AC G! KD GdNEBhGbj6!G Nr<c< SSKnUR5nURS5nURS5nURSS[SSS9 URS S [S S S9 URS S[SSS9 URSS[SSS9 URSSSSS9 URSSSSS9 URSSSSS9 URS S!S"S#S$S%9 URS&S'[SS(S9 URS)S*[S+S,9 URS-S*[S.S,9 UR U5nUR (a8UR(d'URS/5 [R"S 5 UR UR4nURS0:XGaDUR(a'URS15 [R"S 5 UR (a [US29nO [5nURUR 5 URnUc[R""5n[%XR&S39n [R(R*R,n UR.c@U "UR0"[2R4R75R.40U D65 gU "UR0"UR.40U D65 gUR (a [9US29nO [;5nURUR 5 [%UR<UR>S49n URcUR@U S5'URBU S6'URb[EUR5 UR.c:URF"[2R4R75R.40U D6n OSURcURF"UR.40U D6n O(URH"UR.UR40U D6n [R(R,n UR(a?U RKUR5n [R(R*R,n U "U 5 g)7Nrztext only argumentszhtml only argumentsz-wz--widthrRz width of date column (default 2))typedefaulthelpz-lz--linesrTz)number of lines for each week (default 1)z-sz --spacingrbz"spacing between months (default 6)z-mz--monthsr_zmonths per row (default 3)z-cz--cssr~zCSS to use for page)rrz-Lz--localez)locale to use for month and weekday namesz-ez --encodingzencoding to use for outputz-tz--typetext)rhtmlzoutput type (text or html))rchoicesrz-fz--first-weekdayzAweekday (0 is Monday, 6 is Sunday) to start each week (default 0)r?z year number)nargsrrrzmonth number (1-12, text only)z/if --locale is specified --encoding is requiredrzincorrect number of argumentsr)r{rz)r*r+r@r)&argparseArgumentParseradd_argument_group add_argumentint parse_argsrr{errorrwexitrrrrr first_weekdayrxdictrzstdoutbufferwriterr|rrtodayrrrlinesrrrrHr)ry) rrparser textgroup htmlgroupoptionsrr;r{optdictrresults r9mainrs  $ $ &F))*?@I))*?@I  i ! /  i ! 8  k ! 1  j ! )  g "   j 8   l )   h )     ! P      - %G~~g.. FG  ^^W-- -F||v == LL8 9 HHQK >>$F3C.C G112##  --/Hkk: !!'' <<  #$$X]]%8%8%:%?%?K7K L #$$W\\=W= > >>$F3C.C G112'--8 == "??GCL">>GCL == $ GMM * << ^^HMM$7$7$9$>$>J'JF ]] "^^GLLrs7 % !  @ J@X*X K  G     '  <&( $  $ d # d # B G:'?EJvEJPt<8t