# hebrewcal module

The hebrewcal module contains Hebrew calendar related classes and functions.

It contains classes for representing a Hebrew year and month, functions for getting the holiday or fast day for a given date, and classes adapting `calendar` classes to render Hebrew calendars.

## Contents

- `Year`

- `Month`

- `to_hebrew_numeral()`

- `HebrewCalendar`

- `HebrewHTMLCalendar`

- `HebrewTextCalendar`

- `fast_day()`

- `festival()`

- `holiday()`

exception pyluach.hebrewcal.IllegalMonthError(month)

  Bases: `ValueError`

  An exception for an illegal month.

  Subclasses `ValueError` to show a message for an invalid month number for the Hebrew calendar. Mimics `calendar.IllegalMonthError`.

  Parameters:

    month (int) – The invalid month number

  add_note(object, /)

    Exception.add_note(note) – add a note to the exception

  with_traceback(object, /)

    Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception pyluach.hebrewcal.IllegalWeekdayError(weekday)

  Bases: `ValueError`

  An exception for an illegal weekday.

  Subclasses `ValueError` to show a message for an invalid weekday number. Mimics `calendar.IllegalWeekdayError`.

  Parameters:

    month (int) – The invalid month number

  add_note(object, /)

    Exception.add_note(note) – add a note to the exception

  with_traceback(object, /)

    Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class pyluach.hebrewcal.Year(year)

  Bases: `object`

  A Year object represents a Hebrew calendar year.

  It provided the following operators:

  Operation | Result
  --- | ---
  year2 = year1 + int | New `Year` `int` days after year1.
  year2 = year1 - int | New `Year` `int` days before year1.
  int = year1 - year2 | `int` equal to the absolute value of the difference between year2 and year1.
  bool = year1 == year2 | True if year1 represents the same year as year2.
  bool = year1 > year2 | True if year1 is later than year2.
  bool = year1 >= year2 | True if year1 is later or equal to year2.
  bool = year1 < year2 | True if year 1 earlier than year2.
  bool = year1 <= year2 | True if year 1 earlier or equal to year 2.

  Parameters:

    year (int) – A Hebrew year.

  year

    The hebrew year.

    Type:

      int

  leap

    True if the year is a leap year else false.

    Type:

      bool

  monthscount()

    Return number of months in the year.

    Return type:

      int

  itermonths()

    Yield Month instance for each month of the year.

    Yields:

      `Month` – The next month in the Hebrew calendar year as a `Month` instance beginning with Tishrei through Elul.

  iterdays()

    Yield integer for each day of the year.

    Yields:

      `int` – An integer beginning with 1 for the the next day of the year.

  iterdates()

    Iterate through each Hebrew date of the year.

    Yields:

      `pyluach.dates.HebrewDate` – The next date of the Hebrew calendar year starting with the first of Tishrei.

  classmethod from_date(date)

    Return Year object that given date occurs in.

    Parameters:

      date (BaseDate) – Any subclass of `BaseDate`.

    Return type:

      Year

  classmethod from_pydate(pydate)

    Return Year object from python date object.

    Parameters:

      pydate (datetime.date) – A python standard library date object

    Returns:

      The Hebrew year the given date occurs in

    Return type:

      Year

  year_string(thousands=False)

    Return year as a Hebrew string.

    Parameters:

      thousands (bool, optional) – `True` to prefix the year with the thousands place. Default is `False`.

    Examples

        >>> year = Year(5781)
        >>> year.year_string()
        תשפ״א
        >>> year.year_string(True)
        ה׳תשפ״א

class pyluach.hebrewcal.Month(year, month)

  Bases: `object`

  A Month object represents a month of the Hebrew calendar.

  It provides the same operators as a Year object.

  Parameters:

    - year (int)

    - month (int) – The month as an integer starting with 7 for Tishrei through 13 if necessary for Adar Sheni and then 1-6 for Nissan - Elul.

  year

    The Hebrew year.

    Type:

      int

  month

    The month as an integer starting with 7 for Tishrei through 13 if necessary for Adar Sheni and then 1-6 for Nissan - Elul.

    Type:

      int

  classmethod from_date(date)

    Return Month object that given date occurs in.

    Parameters:

      date (BaseDate) – Any subclass of `BaseDate`.

    Returns:

      The Hebrew month the given date occurs in

    Return type:

      Month

  classmethod from_pydate(pydate)

    Return Month object from python date object.

    Parameters:

      pydate (datetime.date) – A python standard library date object

    Returns:

      The Hebrew month the given date occurs in

    Return type:

      Month

  month_name(hebrew=False)

    Return the name of the month.

    Replaces name attribute.

    Parameters:

      hebrew (bool, optional) – True if the month name should be written with Hebrew letters and False to be transliterated into English using the Ashkenazic pronunciation. Default is False.

    Return type:

      str

  month_string(thousands=False)

    Return month and year in Hebrew.

    Parameters:

      thousands (bool, optional) – `True` to prefix year with thousands place. Default is `False`.

    Returns:

      The month and year in Hebrew in the form `f'{month} {year}'`.

    Return type:

      str

  starting_weekday()

    Return first weekday of the month.

    Returns:

      The weekday of the first day of the month starting with Sunday as 1 through Saturday as 7.

    Return type:

      int

  iterdates()

    Iterate through the Hebrew dates of the month.

    Yields:

      `pyluach.dates.HebrewDate` – The next Hebrew date of the month.

  molad()

    Return the month’s molad.

    Returns:

      A dictionary in the form `{weekday: int, hours: int, parts: int}`

    Return type:

      dict

    Note

    This method does not return the molad in the form that is traditionally announced in the shul. This is the molad in the form used to calculate the length of the year.

    See also

    `molad_announcement`

      The molad as it is traditionally announced.

  molad_announcement()

    Return the month’s molad in the announcement form.

    Returns a dictionary in the form that the molad is traditionally announced. The weekday is adjusted to change at midnight and the hour of the day and minutes are given as traditionally announced. Note that the hour is given as in a twenty four hour clock ie. 0 for 12:00 AM through 23 for 11:00 PM.

    Returns:

      A dictionary in the form:

          {
              weekday: int,
              hour: int,
              minutes: int,
              parts: int
          }

    Return type:

      dict

pyluach.hebrewcal.to_hebrew_numeral(num, thousands=False, withgershayim=True)

  Convert int to Hebrew numeral.

  Function useful in formatting Hebrew calendars.

  Parameters:

    - num (int) – The number to convert

    - thousands (bool, optional) – True if the hebrew returned should include a letter for the thousands place ie. ‘ה׳’ for five thousand. Default is `False`.

    - withgershayim (bool, optional) – `True` to include a geresh after a single letter and double geresh before the last letter if there is more than one letter. Default is `True`.

  Returns:

    The Hebrew numeral representation of the number.

  Return type:

    str

class pyluach.hebrewcal.HebrewCalendar(firstweekday=1, hebrewnumerals=True, hebrewweekdays=False, hebrewmonths=False, hebrewyear=False)

  Bases: `Calendar`

  Calendar base class.

  This class extends the python library `Calendar` class for the Hebrew calendar. The weekdays are 1 for Sunday through 7 for Shabbos.

  Parameters:

    - firstweekday (int, optional) – The weekday to start each week with. Default is `1` for Sunday.

    - hebrewnumerals (bool, optional) – Default is `True`, which shows the days of the month with Hebrew numerals. `False` shows the days of the month as a decimal number.

    - hebrewweekdays (bool, optional) – `True` to show the weekday in Hebrew. Default is `False`, which shows the weekday in English.

    - hebrewmonths (bool, optional) – `True` to show the month name in Hebrew. Default is `False`, which shows the month name transliterated into English.

    - hebrewyear (bool, optional) – `True` to show the year in Hebrew numerals. Default is `False`, which shows the year as a decimal number.

  hebrewnumerals
    Type:

      bool

  hebrewweekdays
    Type:

      bool

  hebrewmonths
    Type:

      bool

  hebrewyear
    Type:

      bool

  Note

  All of the parameters other than firstweekday are not used in the `HebrewCalendar` base class. They’re there for use in child classes.

  property firstweekday

    Get and set the weekday the weeks should start with.

    Return type:

      int

  iterweekdays()

    Return one week of weekday numbers.

    The numbers start with the configured first one.

    Yields:

      `int` – The next weekday with 1-7 for Sunday - Shabbos. The iterator starts with the `HebrewCalendar` object’s configured first weekday ie. if configured to start with Monday it will first yield 2 and end with 1.

  itermonthdates(year, month)

    Yield dates for one month.

    The iterator will always iterate through complete weeks, so it will yield dates outside the specified month.

    Parameters:

      - year (int)

      - month (int) – The Hebrew month starting with 1 for Nissan through 13 for Adar Sheni if necessary.

    Yields:

      `pyluach.dates.HebrewDate` – The next Hebrew Date of the month starting with the first date of the week the first of the month falls in, and ending with the last date of the week that the last day of the month falls in.

  itermonthdays(year, month)

    Like `itermonthdates()` but will yield day numbers. For days outside the specified month the day number is 0.

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `int` – The day of the month or 0 if the date is before or after the month.

  itermonthdays2(year, month)

    Return iterator for the days and weekdays of the month.

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `tuple` of `int` – A tuple of ints in the form `(day of month, weekday)`.

  itermonthdays3(year, month)

    Return iterator for the year, month, and day of the month.

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `tuple` of `int` – A tuple of ints in the form `(year, month, day)`.

  itermonthdays4(year, month)

    Return iterator for the year, month, day, and weekday

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `tuple` of `int` – A tuple of ints in the form `(year, month, day, weekday)`.

  yeardatescalendar(year, width=3)

    Return data of specified year ready for formatting.

    Parameters:

      - year (int)

      - width (int, optional) – The number of months per row. Default is 3.

    Returns:

      Returns a list of month rows. Each month row contains a list of up to width months. Each month contains either 5 or 6 weeks, and each week contains 7 days. Days are `HebrewDate` objects.

    Return type:

      `list` of list of list of list of `pyluach.dates.HebrewDate`

  yeardays2calendar(year, width=3)

    Return the data of the specified year ready for formatting.

    This method is similar to the `yeardatescalendar` except the entries in the week lists are `(day number, weekday number)` tuples.

    Parameters:

      - year (int)

      - width (int, optional) – The number of months per row. Default is 3.

    Returns:

      Returns a list of month rows. Each month row contains a list of up to width months. Each month contains between 4 and 6 weeks, and each week contains 1-7 days. Days are tuples with the form `(day number, weekday number)`.

    Return type:

      `list` of list of list of list of `tuple`

  yeardayscalendar(year, width=3)

    Return the data of the specified year ready for formatting.

    This method is similar to the `yeardatescalendar` except the entries in the week lists are day numbers.

    Parameters:

      - year (int)

      - width (int, optional) – The number of months per row. Default is 3.

    Returns:

      Returns a list of month rows. Each month row contains a list of up to width months. Each month contains either 5 or 6 weeks, and each week contains 1-7 days. Each day is the day of the month as an int.

    Return type:

      `list` of list of list of list of `int`

  monthdatescalendar(year, month)

    Return matrix (list of lists) of dates for month’s calendar.

    Each row represents a week; week entries are HebrewDate instances.

    Parameters:

      - year (int)

      - month (int)

    Returns:

      List of weeks in the month containing 7 `HebrewDate` instances each.

    Return type:

      `list` of list of `pyluach.dates.HebrewDate`

  monthdays2calendar(year, month)

    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.

  monthdayscalendar(year, month)

    Return a matrix representing a month’s calendar. Each row represents a week; days outside this month are zero.

class pyluach.hebrewcal.HebrewHTMLCalendar(firstweekday=1, hebrewnumerals=True, hebrewweekdays=False, hebrewmonths=False, hebrewyear=False, rtl=False)

  Bases: `HebrewCalendar`, `HTMLCalendar`

  Class to generate html calendars .

  Adapts `calendar.HTMLCalendar` for the Hebrew calendar.

  Parameters:

    - firstweekday (int, optional) – The weekday to start each week with. Default is `1` for Sunday.

    - hebrewnumerals (bool, optional) – Default is `True`, which shows the days of the month with Hebrew numerals. `False` shows the days of the month as a decimal number.

    - hebrewweekdays (bool, optional) – `True` to show the weekday in Hebrew. Default is `False`, which shows the weekday in English.

    - hebrewmonths (bool, optional) – `True` to show the month name in Hebrew. Default is `False`, which shows the month name transliterated into English.

    - hebrewyear (bool, optional) – `True` to show the year in Hebrew numerals. Default is `False`, which shows the year as a decimal number.

    - rtl (bool, optional) – `True` to arrange the months and the days of the month from right to left. Default is `False`.

  hebrewnumerals
    Type:

      bool

  hebrewweekdays
    Type:

      bool

  hebrewmonths
    Type:

      bool

  hebrewyear
    Type:

      bool

  rtl
    Type:

      bool

  formatday(day, weekday)

    Return a day as an html table cell.

    Parameters:

      - day (int) – The day of the month or zero for a day outside the month.

      - weekday (int) – The weekday with 1 as Sunday through 7 as Shabbos.

    Return type:

      str

  formatweekday(day)

    Return a weekday name as an html table header.

    Parameters:

      day (int) – The day of the week 1-7 with Sunday as 1 and Shabbos as 7.

    Return type:

      str

  formatyearnumber(theyear)

    Return a formatted year.

    Parameters:

      theyear (int)

    Returns:

      If `self.hebrewyear` is `True` return the year as a Hebrew numeral, else return theyear as is.

    Return type:

      int or str

  formatmonthname(theyear, themonth, withyear=True)

    Return month name as an html table row.

    Parameters:

      - theyear (int)

      - themonth (int) – The month as an int 1-12 Nissan - Adar and 13 if leap year.

      - withyear (bool, optional) – `True` to append the year to the month name. Default is `True`.

    Return type:

      str

  formatmonth(theyear, themonth, withyear=True)

    Return a formatted month as an html table.

    Parameters:

      - theyear (int)

      - themonth (int)

      - withyear (bool, optional) – `True` to have the year appended to the month name. Default is `True`.

    Return type:

      str

  formatyear(theyear, width=3)

    Return a formatted year as an html table.

    Parameters:

      - theyear (int)

      - width (int, optional) – The number of months to display per row. Default is 3.

    Return type:

      str

  property firstweekday

    Get and set the weekday the weeks should start with.

    Return type:

      int

  formatweek(theweek)

    Return a complete week as a table row.

  formatweekheader()

    Return a header for a week as a table row.

  formatyearpage(theyear, width=3, css='calendar.css', encoding=None)

    Return a formatted year as a complete HTML page.

  itermonthdates(year, month)

    Yield dates for one month.

    The iterator will always iterate through complete weeks, so it will yield dates outside the specified month.

    Parameters:

      - year (int)

      - month (int) – The Hebrew month starting with 1 for Nissan through 13 for Adar Sheni if necessary.

    Yields:

      `pyluach.dates.HebrewDate` – The next Hebrew Date of the month starting with the first date of the week the first of the month falls in, and ending with the last date of the week that the last day of the month falls in.

  itermonthdays(year, month)

    Like `itermonthdates()` but will yield day numbers. For days outside the specified month the day number is 0.

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `int` – The day of the month or 0 if the date is before or after the month.

  itermonthdays2(year, month)

    Return iterator for the days and weekdays of the month.

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `tuple` of `int` – A tuple of ints in the form `(day of month, weekday)`.

  itermonthdays3(year, month)

    Return iterator for the year, month, and day of the month.

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `tuple` of `int` – A tuple of ints in the form `(year, month, day)`.

  itermonthdays4(year, month)

    Return iterator for the year, month, day, and weekday

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `tuple` of `int` – A tuple of ints in the form `(year, month, day, weekday)`.

  iterweekdays()

    Return one week of weekday numbers.

    The numbers start with the configured first one.

    Yields:

      `int` – The next weekday with 1-7 for Sunday - Shabbos. The iterator starts with the `HebrewCalendar` object’s configured first weekday ie. if configured to start with Monday it will first yield 2 and end with 1.

  monthdatescalendar(year, month)

    Return matrix (list of lists) of dates for month’s calendar.

    Each row represents a week; week entries are HebrewDate instances.

    Parameters:

      - year (int)

      - month (int)

    Returns:

      List of weeks in the month containing 7 `HebrewDate` instances each.

    Return type:

      `list` of list of `pyluach.dates.HebrewDate`

  monthdays2calendar(year, month)

    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.

  monthdayscalendar(year, month)

    Return a matrix representing a month’s calendar. Each row represents a week; days outside this month are zero.

  yeardatescalendar(year, width=3)

    Return data of specified year ready for formatting.

    Parameters:

      - year (int)

      - width (int, optional) – The number of months per row. Default is 3.

    Returns:

      Returns a list of month rows. Each month row contains a list of up to width months. Each month contains either 5 or 6 weeks, and each week contains 7 days. Days are `HebrewDate` objects.

    Return type:

      `list` of list of list of list of `pyluach.dates.HebrewDate`

  yeardays2calendar(year, width=3)

    Return the data of the specified year ready for formatting.

    This method is similar to the `yeardatescalendar` except the entries in the week lists are `(day number, weekday number)` tuples.

    Parameters:

      - year (int)

      - width (int, optional) – The number of months per row. Default is 3.

    Returns:

      Returns a list of month rows. Each month row contains a list of up to width months. Each month contains between 4 and 6 weeks, and each week contains 1-7 days. Days are tuples with the form `(day number, weekday number)`.

    Return type:

      `list` of list of list of list of `tuple`

  yeardayscalendar(year, width=3)

    Return the data of the specified year ready for formatting.

    This method is similar to the `yeardatescalendar` except the entries in the week lists are day numbers.

    Parameters:

      - year (int)

      - width (int, optional) – The number of months per row. Default is 3.

    Returns:

      Returns a list of month rows. Each month row contains a list of up to width months. Each month contains either 5 or 6 weeks, and each week contains 1-7 days. Each day is the day of the month as an int.

    Return type:

      `list` of list of list of list of `int`

class pyluach.hebrewcal.HebrewTextCalendar(firstweekday=1, hebrewnumerals=True, hebrewweekdays=False, hebrewmonths=False, hebrewyear=False)

  Bases: `HebrewCalendar`, `TextCalendar`

  Subclass of HebrewCalendar that outputs a plaintext calendar.

  `HebrewTextCalendar` adapts `calendar.TextCalendar` for the Hebrew calendar.

  Parameters:

    - firstweekday (int, optional) – The weekday to start each week with. Default is `1` for Sunday.

    - hebrewnumerals (bool, optional) – Default is `True`, which shows the days of the month with Hebrew numerals. `False` shows the days of the month as a decimal number.

    - hebrewweekdays (bool, optional) – `True` to show the weekday in Hebrew. Default is `False`, which shows the weekday in English.

    - hebrewmonths (bool, optional) – `True` to show the month name in Hebrew. Default is `False`, which shows the month name transliterated into English.

    - hebrewyear (bool, optional) – `True` to show the year in Hebrew numerals. Default is `False`, which shows the year as a decimal number.

  hebrewnumerals
    Type:

      bool

  hebrewweekdays
    Type:

      bool

  hebrewmonths
    Type:

      bool

  hebrewyear
    Type:

      bool

  Note

  This class generates plain text calendars. Any program that adds any formatting may misrender the calendars especially when using any Hebrew characters.

  formatday(day, weekday, width)

    Return a formatted day.

    Extends calendar.TextCalendar formatday method.

    Parameters:

      - day (int) – The day of the month.

      - weekday (int) – The weekday 1-7 Sunday-Shabbos.

      - width (int) – The width of the day column.

    Return type:

      str

  formatweekday(day, width)

    Return formatted weekday.

    Extends calendar.TextCalendar formatweekday method.

    Parameters:

      - day (int) – The weekday 1-7 Sunday-Shabbos.

      - width (int) – The width of the day column.

    Return type:

      str

  formatmonthname(theyear, themonth, width=0, withyear=True)

    Return formatted month name.

    Parameters:

      - theyear (int)

      - themonth (int) – 1-12 or 13 for Nissan-Adar Sheni

      - width (int, optional) – The number of columns per day. Default is 0

      - withyear (bool, optional) – Default is `True` to include the year with the month name.

    Return type:

      str

  formatyear(theyear, w=2, l=1, c=6, m=3)

    Return a year’s calendar as a multi-line string.

    Parameters:

      - theyear (int)

      - w (int, optional) – The date column width. Default is 2

      - l (int, optional) – The number of lines per week. Default is 1.

      - c (int, optional) – The number of columns in between each month. Default is 6

      - m (int, optional) – The number of months per row. Default is 3.

    Return type:

      str

  property firstweekday

    Get and set the weekday the weeks should start with.

    Return type:

      int

  formatmonth(theyear, themonth, w=0, l=0)

    Return a month’s calendar string (multi-line).

  formatweek(theweek, width)

    Returns a single week in a string (no newline).

  formatweekheader(width)

    Return a header for a week.

  itermonthdates(year, month)

    Yield dates for one month.

    The iterator will always iterate through complete weeks, so it will yield dates outside the specified month.

    Parameters:

      - year (int)

      - month (int) – The Hebrew month starting with 1 for Nissan through 13 for Adar Sheni if necessary.

    Yields:

      `pyluach.dates.HebrewDate` – The next Hebrew Date of the month starting with the first date of the week the first of the month falls in, and ending with the last date of the week that the last day of the month falls in.

  itermonthdays(year, month)

    Like `itermonthdates()` but will yield day numbers. For days outside the specified month the day number is 0.

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `int` – The day of the month or 0 if the date is before or after the month.

  itermonthdays2(year, month)

    Return iterator for the days and weekdays of the month.

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `tuple` of `int` – A tuple of ints in the form `(day of month, weekday)`.

  itermonthdays3(year, month)

    Return iterator for the year, month, and day of the month.

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `tuple` of `int` – A tuple of ints in the form `(year, month, day)`.

  itermonthdays4(year, month)

    Return iterator for the year, month, day, and weekday

    Parameters:

      - year (int)

      - month (int)

    Yields:

      `tuple` of `int` – A tuple of ints in the form `(year, month, day, weekday)`.

  iterweekdays()

    Return one week of weekday numbers.

    The numbers start with the configured first one.

    Yields:

      `int` – The next weekday with 1-7 for Sunday - Shabbos. The iterator starts with the `HebrewCalendar` object’s configured first weekday ie. if configured to start with Monday it will first yield 2 and end with 1.

  monthdatescalendar(year, month)

    Return matrix (list of lists) of dates for month’s calendar.

    Each row represents a week; week entries are HebrewDate instances.

    Parameters:

      - year (int)

      - month (int)

    Returns:

      List of weeks in the month containing 7 `HebrewDate` instances each.

    Return type:

      `list` of list of `pyluach.dates.HebrewDate`

  monthdays2calendar(year, month)

    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.

  monthdayscalendar(year, month)

    Return a matrix representing a month’s calendar. Each row represents a week; days outside this month are zero.

  prmonth(theyear, themonth, w=0, l=0)

    Print a month’s calendar.

  prweek(theweek, width)

    Print a single week (no newline).

  pryear(theyear, w=0, l=0, c=6, m=3)

    Print a year’s calendar.

  yeardatescalendar(year, width=3)

    Return data of specified year ready for formatting.

    Parameters:

      - year (int)

      - width (int, optional) – The number of months per row. Default is 3.

    Returns:

      Returns a list of month rows. Each month row contains a list of up to width months. Each month contains either 5 or 6 weeks, and each week contains 7 days. Days are `HebrewDate` objects.

    Return type:

      `list` of list of list of list of `pyluach.dates.HebrewDate`

  yeardays2calendar(year, width=3)

    Return the data of the specified year ready for formatting.

    This method is similar to the `yeardatescalendar` except the entries in the week lists are `(day number, weekday number)` tuples.

    Parameters:

      - year (int)

      - width (int, optional) – The number of months per row. Default is 3.

    Returns:

      Returns a list of month rows. Each month row contains a list of up to width months. Each month contains between 4 and 6 weeks, and each week contains 1-7 days. Days are tuples with the form `(day number, weekday number)`.

    Return type:

      `list` of list of list of list of `tuple`

  yeardayscalendar(year, width=3)

    Return the data of the specified year ready for formatting.

    This method is similar to the `yeardatescalendar` except the entries in the week lists are day numbers.

    Parameters:

      - year (int)

      - width (int, optional) – The number of months per row. Default is 3.

    Returns:

      Returns a list of month rows. Each month row contains a list of up to width months. Each month contains either 5 or 6 weeks, and each week contains 1-7 days. Each day is the day of the month as an int.

    Return type:

      `list` of list of list of list of `int`

pyluach.hebrewcal.fast_day(date, hebrew=False)

  Return name of fast day or None.

  Parameters:

    - date (BaseDate) – Any date instance from a subclass of `BaseDate` can be used.

    - hebrew (bool, optional) – `True` if you want the fast_day name in Hebrew letters. Default is `False`, which returns the name transliterated into English.

  Returns:

    The name of the fast day or `None` if the given date is not a fast day.

  Return type:

    str or None

pyluach.hebrewcal.festival(date, israel=False, hebrew=False, include_working_days=True, prefix_day=False)

  Return Jewish festival of given day.

  This method will return all major and minor religous Jewish holidays not including fast days.

  Parameters:

    - date (BaseDate) – Any subclass of `BaseDate` can be used.

    - israel (bool, optional) – `True` if you want the festivals according to the Israel schedule. Defaults to `False`.

    - hebrew (bool, optional) – `True` if you want the festival name in Hebrew letters. Default is `False`, which returns the name transliterated into English.

    - include_working_days (bool, optional) – `True` to include festival days on which melacha (work) is allowed; ie. Pesach Sheni, Chol Hamoed, etc. Default is `True`.

    - prefix_day (bool, optional) – `True` to prefix multi day festivals with the day of the festival. Default is `False`.

  Returns:

    The name of the festival or `None` if the given date is not a Jewish festival.

  Return type:

    str or None

  Examples

      >>> from pyluach.dates import HebrewDate
      pesach = HebrewDate(2023, 1, 15)
      >>> festival(pesach, prefix_day=True)
      '1 Pesach'
      >>> festival(pesach, hebrew=True, prefix_day=True)
      'א׳ פסח'
      >>> shavuos = HebrewDate(5783, 3, 6)
      >>> festival(shavuos, israel=True, prefix_day=True)
      'Shavuos'

pyluach.hebrewcal.holiday(date, israel=False, hebrew=False, prefix_day=False)

  Return Jewish holiday of given date.

  The holidays include the major and minor religious Jewish holidays including fast days.

  Parameters:

    - date (pyluach.dates.BaseDate) – Any subclass of `BaseDate` can be used.

    - israel (bool, optional) – `True` if you want the holidays according to the israel schedule. Default is `False`.

    - hebrew (bool, optional) – `True` if you want the holiday name in Hebrew letters. Default is `False`, which returns the name transliterated into English.

    - prefix_day (bool, optional) – `True` to prefix multi day holidays with the day of the holiday. Default is `False`.

  Returns:

    The name of the holiday or `None` if the given date is not a Jewish holiday.

  Return type:

    str or None

  Examples

      >>> from pyluach.dates import HebrewDate
      >>> pesach = HebrewDate(2023, 1, 15)
      >>> holiday(pesach, prefix_day=True)
      '1 Pesach'
      >>> holiday(pesach, hebrew=True, prefix_day=True)
      'א׳ פסח'
      >>> taanis_esther = HebrewDate(5783, 12, 13)
      >>> holiday(taanis_esther, prefix_day=True)
      'Taanis Esther'