|
| 1 | +import calendar |
| 2 | +import datetime |
| 3 | +from collections.abc import Generator |
| 4 | +from typing import Literal, TypedDict, overload, type_check_only |
| 5 | +from typing_extensions import Self |
| 6 | + |
| 7 | +from .dates import BaseDate, HebrewDate |
| 8 | + |
| 9 | +@type_check_only |
| 10 | +class _MoladDict(TypedDict): |
| 11 | + weekday: int |
| 12 | + hours: int |
| 13 | + parts: int |
| 14 | + |
| 15 | +@type_check_only |
| 16 | +class _MoladAnnouncementDict(TypedDict): |
| 17 | + weekday: int |
| 18 | + hour: int |
| 19 | + minutes: int |
| 20 | + parts: int |
| 21 | + |
| 22 | +class IllegalMonthError(ValueError): |
| 23 | + month: int |
| 24 | + def __init__(self, month: int) -> None: ... |
| 25 | + |
| 26 | +class IllegalWeekdayError(ValueError): |
| 27 | + weekday: int |
| 28 | + def __init__(self, weekday: int) -> None: ... |
| 29 | + |
| 30 | +class Year: |
| 31 | + year: int |
| 32 | + leap: bool |
| 33 | + def __init__(self, year: int) -> None: ... |
| 34 | + def __len__(self) -> int: ... |
| 35 | + def __eq__(self, other: object) -> bool: ... |
| 36 | + def __add__(self, other: int) -> Year: ... |
| 37 | + @overload |
| 38 | + def __sub__(self, other: int) -> Year: ... |
| 39 | + @overload |
| 40 | + def __sub__(self, other: Year) -> int: ... |
| 41 | + def __gt__(self, other: Year) -> bool: ... |
| 42 | + def __ge__(self, other: Year) -> bool: ... |
| 43 | + def __lt__(self, other: Year) -> bool: ... |
| 44 | + def __le__(self, other: Year) -> bool: ... |
| 45 | + def __iter__(self) -> Generator[int]: ... |
| 46 | + def monthscount(self) -> Literal[12, 13]: ... |
| 47 | + def itermonths(self) -> Generator[Month]: ... |
| 48 | + def iterdays(self) -> Generator[int]: ... |
| 49 | + def iterdates(self) -> Generator[HebrewDate]: ... |
| 50 | + @classmethod |
| 51 | + def from_date(cls, date: BaseDate) -> Self: ... |
| 52 | + @classmethod |
| 53 | + def from_pydate(cls, pydate: datetime.date) -> Self: ... |
| 54 | + def year_string(self, thousands: bool = False) -> str: ... |
| 55 | + |
| 56 | +class Month: |
| 57 | + year: int |
| 58 | + month: int |
| 59 | + def __init__(self, year: int, month: int) -> None: ... |
| 60 | + def __len__(self) -> int: ... |
| 61 | + def __iter__(self) -> Generator[int]: ... |
| 62 | + def __eq__(self, other: object) -> bool: ... |
| 63 | + def __add__(self, other: int) -> Month: ... |
| 64 | + @overload |
| 65 | + def __sub__(self, other: int) -> Month: ... |
| 66 | + @overload |
| 67 | + def __sub__(self, other: Month) -> int: ... |
| 68 | + def __gt__(self, other: Month) -> bool: ... |
| 69 | + def __ge__(self, other: Month) -> bool: ... |
| 70 | + def __lt__(self, other: Month) -> bool: ... |
| 71 | + def __le__(self, other: Month) -> bool: ... |
| 72 | + @classmethod |
| 73 | + def from_date(cls, date: BaseDate) -> Month: ... |
| 74 | + @classmethod |
| 75 | + def from_pydate(cls, pydate: datetime.date) -> Month: ... |
| 76 | + def month_name(self, hebrew: bool = False) -> str: ... |
| 77 | + def month_string(self, thousands: bool = False) -> str: ... |
| 78 | + def starting_weekday(self) -> int: ... |
| 79 | + def iterdates(self) -> Generator[HebrewDate]: ... |
| 80 | + def molad(self) -> _MoladDict: ... |
| 81 | + def molad_announcement(self) -> _MoladAnnouncementDict: ... |
| 82 | + |
| 83 | +def to_hebrew_numeral(num: int, thousands: bool = False, withgershayim: bool = True) -> str: ... |
| 84 | + |
| 85 | +class HebrewCalendar(calendar.Calendar): |
| 86 | + hebrewnumerals: bool |
| 87 | + hebrewweekdays: bool |
| 88 | + hebrewmonths: bool |
| 89 | + hebrewyear: bool |
| 90 | + def __init__( |
| 91 | + self, |
| 92 | + firstweekday: int = 1, |
| 93 | + hebrewnumerals: bool = True, |
| 94 | + hebrewweekdays: bool = False, |
| 95 | + hebrewmonths: bool = False, |
| 96 | + hebrewyear: bool = False, |
| 97 | + ) -> None: ... |
| 98 | + @property |
| 99 | + def firstweekday(self) -> int: ... |
| 100 | + @firstweekday.setter |
| 101 | + def firstweekday(self, thefirstweekday: int) -> None: ... |
| 102 | + def iterweekdays(self) -> Generator[int]: ... |
| 103 | + def itermonthdates(self, year: int, month: int) -> Generator[HebrewDate]: ... # type: ignore[override] |
| 104 | + def itermonthdays(self, year: int, month: int) -> Generator[int]: ... |
| 105 | + def itermonthdays2(self, year: int, month: int) -> Generator[tuple[int, int]]: ... |
| 106 | + def itermonthdays3(self, year: int, month: int) -> Generator[tuple[int, int, int]]: ... |
| 107 | + def itermonthdays4(self, year: int, month: int) -> Generator[tuple[int, int, int, int]]: ... |
| 108 | + def yeardatescalendar(self, year: int, width: int = 3) -> list[list[list[list[HebrewDate]]]]: ... # type: ignore[override] |
| 109 | + def yeardays2calendar(self, year: int, width: int = 3) -> list[list[list[list[tuple[int, int]]]]]: ... |
| 110 | + def yeardayscalendar(self, year: int, width: int = 3) -> list[list[list[list[int]]]]: ... |
| 111 | + def monthdatescalendar(self, year: int, month: int) -> list[list[HebrewDate]]: ... # type: ignore[override] |
| 112 | + |
| 113 | +class HebrewHTMLCalendar(HebrewCalendar, calendar.HTMLCalendar): |
| 114 | + rtl: bool |
| 115 | + def __init__( |
| 116 | + self, |
| 117 | + firstweekday: int = 1, |
| 118 | + hebrewnumerals: bool = True, |
| 119 | + hebrewweekdays: bool = False, |
| 120 | + hebrewmonths: bool = False, |
| 121 | + hebrewyear: bool = False, |
| 122 | + rtl: bool = False, |
| 123 | + ) -> None: ... |
| 124 | + def formatday(self, day: int, weekday: int) -> str: ... |
| 125 | + def formatweekday(self, day: int) -> str: ... |
| 126 | + def formatyearnumber(self, theyear: int) -> int | str: ... |
| 127 | + def formatmonthname(self, theyear: int, themonth: int, withyear: bool = True) -> str: ... |
| 128 | + def formatmonth(self, theyear: int, themonth: int, withyear: bool = True) -> str: ... |
| 129 | + def formatyear(self, theyear: int, width: int = 3) -> str: ... |
| 130 | + |
| 131 | +class HebrewTextCalendar(HebrewCalendar, calendar.TextCalendar): |
| 132 | + def formatday(self, day: int, weekday: int, width: int) -> str: ... |
| 133 | + def formatweekday(self, day: int, width: int) -> str: ... |
| 134 | + def formatmonthname(self, theyear: int, themonth: int, width: int = 0, withyear: bool = True) -> str: ... |
| 135 | + def formatyear(self, theyear: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: ... |
| 136 | + |
| 137 | +def fast_day(date: BaseDate, hebrew: bool = False) -> str | None: ... |
| 138 | +def festival( |
| 139 | + date: BaseDate, israel: bool = False, hebrew: bool = False, include_working_days: bool = True, prefix_day: bool = False |
| 140 | +) -> str | None: ... |
| 141 | +def holiday(date: BaseDate, israel: bool = False, hebrew: bool = False, prefix_day: bool = False) -> str | None: ... |
0 commit comments