Ë
    u™ãj=ž  ã                  ó>  — U d dl mZ d dlmZmZ d dlmZmZmZ d dlZd dl	m
Z
mZmZmZmZmZmZ d dlZd dlmZ d dlmZ d dlmZmZmZmZmZmZ d d	lmZm Z  erd d
l!m"Z" d;d„Z#d;d„Z$d;d„Z%d;d„Z&d;d„Z'd;d„Z(d;d„Z)d;d„Z*d;d„Z+d;d„Z, G d„ d«      Z-i Z.de/d<   d<d„Z0d=d„Z1 G d„ de2«      Z3 G d„ de3¬«      Z4 e-d d!d" e ed#«      ¬$«      ¬%«      Z5 e-d&d'd( e ed(«      ¬$«      ¬%«      Z6 e-d)d*d( e ed+«      ¬$«      ¬%«      Z7 e-d,d-d( e ed.«      ¬$«      ¬%«      Z8 e-d/ ed0d(d(«      d(d( e ed1«      ¬$«      ¬2«      Z9 e-d3d+d( e ed1«      ¬$«      ¬%«      Z: e-d4d(d( e «        ed5«      g¬%«      Z; e-d6d(d( e «        ed(«      g¬%«      Z< G d7„ d8e4«      Z=e4fd>d9„Z>g d:¢Z?y)?é    )Úannotations)ÚdatetimeÚ	timedelta)ÚTYPE_CHECKINGÚLiteralÚoverloadN)ÚFRÚMOÚSAÚSUÚTHÚTUÚWE)Ú
BaseOffset)ÚPerformanceWarning)Ú
DateOffsetÚDatetimeIndexÚSeriesÚ	TimestampÚconcatÚ
date_range)ÚDayÚEaster)ÚCallablec                óŠ   — | j                  «       dk(  r| t        d«      z   S | j                  «       dk(  r| t        d«      z   S | S )a¢  
    Move Saturday and Sunday to the following Monday.

    A holiday on a weekday keeps its date.

    Parameters
    ----------
    dt : datetime
        The date the holiday falls on.

    Returns
    -------
    datetime
        The date the holiday is observed on.

    See Also
    --------
    tseries.holiday.weekend_to_monday : Move Saturday and Sunday to the
        following Monday.
    tseries.holiday.next_monday_or_tuesday : Move Saturday to Monday, and
        Sunday or Monday to Tuesday.
    tseries.holiday.Holiday : Class that defines a holiday with start/end
        dates and rules for observance.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import next_monday
    >>> next_monday(datetime(2022, 1, 1))  # Saturday
    datetime.datetime(2022, 1, 3, 0, 0)
    >>> next_monday(datetime(2022, 1, 2))  # Sunday
    datetime.datetime(2022, 1, 3, 0, 0)
    é   é   é   é   ©Úweekdayr   ©Údts    úa/var/www/html/python-recuperauto-other/env/lib/python3.12/site-packages/pandas/tseries/holiday.pyÚnext_mondayr%   .   óD   € ðD 
‡z�zƒ|�qÒØ”I˜a“LÑ Ð Ø	�‰‹˜Ò	Ø”I˜a“LÑ Ð Ø€Ió    c                óp   — | j                  «       }|dv r| t        d«      z   S |dk(  r| t        d«      z   S | S )as  
    Move Saturday to Monday, and Sunday or Monday to Tuesday.

    Use this for the second of two adjacent holidays, where the Monday is
    already taken by the holiday of the day before.

    Parameters
    ----------
    dt : datetime
        The date the holiday falls on.

    Returns
    -------
    datetime
        The date the holiday is observed on.

    See Also
    --------
    tseries.holiday.next_monday : Move Saturday and Sunday to the following
        Monday.
    tseries.holiday.after_nearest_workday : Move to the workday after the
        nearest workday.
    tseries.holiday.Holiday : Class that defines a holiday with start/end
        dates and rules for observance.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import next_monday_or_tuesday
    >>> next_monday_or_tuesday(datetime(2022, 1, 1))  # Saturday
    datetime.datetime(2022, 1, 3, 0, 0)
    >>> next_monday_or_tuesday(datetime(2022, 1, 2))  # Sunday
    datetime.datetime(2022, 1, 4, 0, 0)
    >>> next_monday_or_tuesday(datetime(2022, 1, 3))  # Monday
    datetime.datetime(2022, 1, 4, 0, 0)
    )r   r   r   r   r   r    )r#   Údows     r$   Únext_monday_or_tuesdayr*   W   sA   € ðJ �*‰*‹,€CØ
ˆf�}Ø”I˜a“LÑ Ð Ø
ˆa‚xØ”I˜a“LÑ Ð Ø€Ir'   c                óŠ   — | j                  «       dk(  r| t        d«      z
  S | j                  «       dk(  r| t        d«      z
  S | S )a†  
    Move Saturday and Sunday back to the previous Friday.

    A holiday on a weekday keeps its date.

    Parameters
    ----------
    dt : datetime
        The date the holiday falls on.

    Returns
    -------
    datetime
        The date the holiday is observed on.

    See Also
    --------
    tseries.holiday.next_monday : Move Saturday and Sunday to the following
        Monday.
    tseries.holiday.previous_workday : Move to the previous weekday.
    tseries.holiday.Holiday : Class that defines a holiday with start/end
        dates and rules for observance.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import previous_friday
    >>> previous_friday(datetime(2022, 1, 1))  # Saturday
    datetime.datetime(2021, 12, 31, 0, 0)
    >>> previous_friday(datetime(2022, 1, 2))  # Sunday
    datetime.datetime(2021, 12, 31, 0, 0)
    r   r   r   r   r    r"   s    r$   Úprevious_fridayr,   „   sD   € ðB 
‡z�zƒ|�qÒØ”I˜a“LÑ Ð Ø	�‰‹˜Ò	Ø”I˜a“LÑ Ð Ø€Ir'   c                óH   — | j                  «       dk(  r| t        d«      z   S | S )a   
    Move Sunday to the following Monday.

    A holiday on a Saturday stays where it is.

    Parameters
    ----------
    dt : datetime
        The date the holiday falls on.

    Returns
    -------
    datetime
        The date the holiday is observed on.

    See Also
    --------
    tseries.holiday.weekend_to_monday : Move Saturday and Sunday to the
        following Monday.
    tseries.holiday.nearest_workday : Move Saturday to Friday and Sunday to
        Monday.
    tseries.holiday.Holiday : Class that defines a holiday with start/end
        dates and rules for observance.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import sunday_to_monday
    >>> sunday_to_monday(datetime(2022, 1, 2))  # Sunday
    datetime.datetime(2022, 1, 3, 0, 0)
    >>> sunday_to_monday(datetime(2022, 1, 1))  # Saturday, unchanged
    datetime.datetime(2022, 1, 1, 0, 0)
    r   r   r    r"   s    r$   Úsunday_to_mondayr.   ¬   s'   € ðD 
‡z�zƒ|�qÒØ”I˜a“LÑ Ð Ø€Ir'   c                óŠ   — | j                  «       dk(  r| t        d«      z   S | j                  «       dk(  r| t        d«      z   S | S )aÂ  
    Move Saturday and Sunday to the following Monday.

    Same as ``next_monday``. Needed for holidays such as the Christmas
    observation in Europe.

    Parameters
    ----------
    dt : datetime
        The date the holiday falls on.

    Returns
    -------
    datetime
        The date the holiday is observed on.

    See Also
    --------
    tseries.holiday.next_monday : Move Saturday and Sunday to the following
        Monday.
    tseries.holiday.sunday_to_monday : Move Sunday to the following Monday.
    tseries.holiday.Holiday : Class that defines a holiday with start/end
        dates and rules for observance.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import weekend_to_monday
    >>> weekend_to_monday(datetime(2022, 1, 1))  # Saturday
    datetime.datetime(2022, 1, 3, 0, 0)
    >>> weekend_to_monday(datetime(2022, 1, 2))  # Sunday
    datetime.datetime(2022, 1, 3, 0, 0)
    r   r   r   r   r    r"   s    r$   Úweekend_to_mondayr0   Ó   r&   r'   c                óŠ   — | j                  «       dk(  r| t        d«      z
  S | j                  «       dk(  r| t        d«      z   S | S )a”  
    Move Saturday to Friday and Sunday to Monday.

    Most US federal holidays follow this rule.

    Parameters
    ----------
    dt : datetime
        The date the holiday falls on.

    Returns
    -------
    datetime
        The date the holiday is observed on.

    See Also
    --------
    tseries.holiday.before_nearest_workday : Move to the workday before the
        nearest workday.
    tseries.holiday.after_nearest_workday : Move to the workday after the
        nearest workday.
    tseries.holiday.USFederalHolidayCalendar : US Federal Government holiday
        calendar.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import nearest_workday
    >>> nearest_workday(datetime(2022, 1, 1))  # Saturday
    datetime.datetime(2021, 12, 31, 0, 0)
    >>> nearest_workday(datetime(2022, 1, 2))  # Sunday
    datetime.datetime(2022, 1, 3, 0, 0)
    r   r   r   r    r"   s    r$   Únearest_workdayr2   ü   r&   r'   c                ó�   — | t        d¬«      z  } | j                  «       dkD  r#| t        d¬«      z  } | j                  «       dkD  rŒ#| S )a	  
    Move to the next weekday.

    The date is always advanced by at least one day, even when ``dt`` already
    falls on a weekday. To leave weekdays unchanged and move only weekend
    dates forward, use ``next_monday`` or ``weekend_to_monday``.

    Parameters
    ----------
    dt : datetime
        The date to move forward from.

    Returns
    -------
    datetime
        The next weekday after ``dt``.

    See Also
    --------
    tseries.holiday.previous_workday : Move to the previous weekday.
    tseries.holiday.next_monday : Move Saturday and Sunday to the following
        Monday.
    tseries.holiday.after_nearest_workday : Move to the workday after the
        nearest workday.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import next_workday
    >>> next_workday(datetime(2022, 1, 1))  # Saturday
    datetime.datetime(2022, 1, 3, 0, 0)
    >>> next_workday(datetime(2022, 1, 5))  # Wednesday, still advances
    datetime.datetime(2022, 1, 6, 0, 0)
    r   ©Údaysé   ©r   r!   r"   s    r$   Únext_workdayr8   %  óH   € ðF Œ)˜Ô
Ñ€BØ
�*‰*‹,˜Ò
à
Œi˜QÔÑˆð �*‰*‹,˜Ó
ð €Ir'   c                ó�   — | t        d¬«      z  } | j                  «       dkD  r#| t        d¬«      z  } | j                  «       dkD  rŒ#| S )a	  
    Move to the previous weekday.

    The date is always moved back by at least one day, even when ``dt``
    already falls on a weekday. To leave weekdays unchanged and move only
    weekend dates back, use ``previous_friday``.

    Parameters
    ----------
    dt : datetime
        The date to move back from.

    Returns
    -------
    datetime
        The previous weekday before ``dt``.

    See Also
    --------
    tseries.holiday.next_workday : Move to the next weekday.
    tseries.holiday.previous_friday : Move Saturday and Sunday back to the
        previous Friday.
    tseries.holiday.before_nearest_workday : Move to the workday before the
        nearest workday.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import previous_workday
    >>> previous_workday(datetime(2022, 1, 2))  # Sunday
    datetime.datetime(2021, 12, 31, 0, 0)
    >>> previous_workday(datetime(2022, 1, 5))  # Wednesday, still moves back
    datetime.datetime(2022, 1, 4, 0, 0)
    r   r4   r6   r7   r"   s    r$   Úprevious_workdayr;   O  r9   r'   c                ó*   — t        t        | «      «      S )a¼  
    Move to the workday before the nearest workday.

    ``nearest_workday`` runs first, so a Saturday holiday ends up on the
    Thursday before it.

    Parameters
    ----------
    dt : datetime
        The date the holiday falls on.

    Returns
    -------
    datetime
        The date the holiday is observed on.

    See Also
    --------
    tseries.holiday.nearest_workday : Move Saturday to Friday and Sunday to
        Monday.
    tseries.holiday.after_nearest_workday : Move to the workday after the
        nearest workday.
    tseries.holiday.previous_workday : Move to the previous weekday.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import before_nearest_workday
    >>> before_nearest_workday(datetime(2022, 1, 1))  # Saturday
    datetime.datetime(2021, 12, 30, 0, 0)
    >>> before_nearest_workday(datetime(2022, 1, 2))  # Sunday
    datetime.datetime(2021, 12, 31, 0, 0)
    )r;   r2   r"   s    r$   Úbefore_nearest_workdayr=   y  s   € ôD œO¨BÓ/Ó0Ð0r'   c                ó*   — t        t        | «      «      S )aŠ  
    Move to the workday after the nearest workday.

    Needed for Boxing Day, or for several holidays in a row.

    Parameters
    ----------
    dt : datetime
        The date the holiday falls on.

    Returns
    -------
    datetime
        The date the holiday is observed on.

    See Also
    --------
    tseries.holiday.nearest_workday : Move Saturday to Friday and Sunday to
        Monday.
    tseries.holiday.before_nearest_workday : Move to the workday before the
        nearest workday.
    tseries.holiday.next_workday : Move to the next weekday.

    Examples
    --------
    >>> from datetime import datetime
    >>> from pandas.tseries.holiday import after_nearest_workday
    >>> after_nearest_workday(datetime(2022, 1, 1))  # Saturday
    datetime.datetime(2022, 1, 3, 0, 0)
    >>> after_nearest_workday(datetime(2022, 1, 2))  # Sunday
    datetime.datetime(2022, 1, 4, 0, 0)
    )r8   r2   r"   s    r$   Úafter_nearest_workdayr?   ž  s   € ôB œ¨Ó+Ó,Ð,r'   c                  óÖ   — e Zd ZU dZded<   ded<   ded<   	 	 	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 dd„Zdd	„Zedd
„«       Ze	 	 	 	 dd„«       Zedd„«       Z	 d	 	 	 dd„Z	 	 	 	 	 	 dd„Z	dd„Z
y)ÚHolidayaÛ  
    Class that defines a holiday with start/end dates and rules for observance.

    A ``Holiday`` can either be defined by a fixed ``year``/``month``/``day``,
    or, more commonly, by a recurring ``month``/``day`` combined with an
    ``offset`` or ``observance`` rule that adjusts the date in each year it
    is calculated for. Instances of ``Holiday`` are typically collected in
    the ``rules`` of an :class:`~pandas.tseries.holiday.AbstractHolidayCalendar`.

    Parameters
    ----------
    name : str
        Name of the holiday, defaults to class name.
    year : int, default None
        Year of the holiday.
    month : int, default None
        Month of the holiday.
    day : int, default None
        Day of the holiday.
    offset : DateOffset or list of DateOffset, default None
        Computes offset from date. See :mod:`pandas.tseries.offsets` for the
        available offset classes.
    observance : function, default None
        Computes when holiday is given a pandas Timestamp.
    start_date : datetime-like, default None
        First date the holiday is observed.
    end_date : datetime-like, default None
        Last date the holiday is observed.
    days_of_week : tuple of int or dateutil.relativedelta weekday strs, default None
        Provide a tuple of days e.g  (0,1,2,3,) for Monday through Thursday
        Monday=0,..,Sunday=6
        Only instances of the holiday included in days_of_week will be computed.
    exclude_dates : DatetimeIndex or default None
        Specific dates to exclude e.g. skipping a specific year's holiday.

    See Also
    --------
    tseries.holiday.AbstractHolidayCalendar : Abstract interface to create
        holidays following certain rules.
    tseries.holiday.Holiday.dates : Calculate holidays observed between
        start date and end date.

    Examples
    --------
    >>> from dateutil.relativedelta import MO

    >>> USMemorialDay = pd.tseries.holiday.Holiday(
    ...     "Memorial Day", month=5, day=31, offset=pd.DateOffset(weekday=MO(-1))
    ... )
    >>> USMemorialDay
    Holiday: Memorial Day (month=5, day=31, offset=<DateOffset: weekday=MO(-1)>)

    >>> USLaborDay = pd.tseries.holiday.Holiday(
    ...     "Labor Day", month=9, day=1, offset=pd.DateOffset(weekday=MO(1))
    ... )
    >>> USLaborDay
    Holiday: Labor Day (month=9, day=1, offset=<DateOffset: weekday=MO(+1)>)

    >>> July3rd = pd.tseries.holiday.Holiday("July 3rd", month=7, day=3)
    >>> July3rd
    Holiday: July 3rd (month=7, day=3, )

    >>> NewYears = pd.tseries.holiday.Holiday(
    ...     "New Years Day",
    ...     month=1,
    ...     day=1,
    ...     observance=pd.tseries.holiday.nearest_workday,
    ... )
    >>> NewYears  # doctest: +SKIP
    Holiday: New Years Day (
        month=1, day=1, observance=<function nearest_workday at 0x66545e9bc440>
    )

    >>> July3rd = pd.tseries.holiday.Holiday(
    ...     "July 3rd", month=7, day=3, days_of_week=(0, 1, 2, 3)
    ... )
    >>> July3rd
    Holiday: July 3rd (month=7, day=3, )
    zTimestamp | NoneÚ
start_dateÚend_dateútuple[int, ...] | NoneÚdays_of_weekNc                óÐ  — |�J|�t        d«      ‚t        |t        «      s-t        |t        «      rt	        d„ |D «       «      st        d«      ‚|| _        || _        || _        || _	        || _
        |�t        |«      n|| _        |�t        |«      n|| _        || _        |	�t        |	t        «      st        d«      ‚|	| _        |
�t        |
t"        «      st        d«      ‚|
| _        y )Nz&Cannot use both offset and observance.c              3  ó<   K  — | ]  }t        |t        «      –— Œ y ­w©N)Ú
isinstancer   )Ú.0Úoffs     r$   ú	<genexpr>z#Holiday.__init__.<locals>.<genexpr>+  s   è ø€ ÒJ¸CœJ s¬J×7ÑJùs   ‚zAOnly BaseOffsets and flat lists of them are supported for offset.z#days_of_week must be None or tuple.z4exclude_dates must be None or of type DatetimeIndex.)ÚNotImplementedErrorrI   r   ÚlistÚallÚ
ValueErrorÚnameÚyearÚmonthÚdayÚoffsetr   rB   rC   Ú
observanceÚtuplerE   r   Úexclude_dates)ÚselfrQ   rR   rS   rT   rU   rV   rB   rC   rE   rX   s              r$   Ú__init__zHoliday.__init__  sí   € ð ÐØÐ%Ü)Ð*RÓSÐSä˜6¤:Ô.ä˜v¤tÔ,ÜÑJÀ6ÔJÔJô !ØWóð ð ˆŒ	ØˆŒ	ØˆŒ
ØˆŒØˆŒà%/Ð%;ŒI�jÔ!Àð 	Œð 08Ð/Cœ	 (Ô+ÈˆŒØ$ˆŒØÐ$¬
°<ÄÔ(GÜÐBÓCÐCØ(ˆÔØÐ%¬°MÄ=Ô)QÜÐSÓTÐTØ*ˆÕr'   c                ó&  — d}| j                   �|d| j                   › d�z  }|d| j                  › d| j                  › d�z  }| j                  �|d| j                  › �z  }| j                  �|d| j                  › �z  }d| j
                  › d	|› d
�}|S )NÚ zyear=z, zmonth=z, day=zoffset=zobservance=z	Holiday: z (ú))rR   rS   rT   rU   rV   rQ   )rY   ÚinfoÚreprs      r$   Ú__repr__zHoliday.__repr__C  s¥   € ØˆØ�9‰9Ð Ø�e˜DŸI™I˜; bÐ)Ñ)ˆDØ�&˜Ÿ™˜ F¨4¯8©8¨*°BÐ7Ñ7ˆà�;‰;Ð"Ø�g˜dŸk™k˜]Ð+Ñ+ˆDà�?‰?Ð&Ø�k $§/¡/Ð!2Ð3Ñ3ˆDà˜4Ÿ9™9˜+ R¨ v¨QÐ/ˆØˆr'   c                 ó   — y rH   © ©rY   rB   rC   Úreturn_names       r$   ÚdateszHoliday.datesR  s   € ØQTr'   c                 ó   — y rH   rb   rc   s       r$   re   zHoliday.datesU  s   € ð r'   c                 ó   — y rH   rb   )rY   rB   rC   s      r$   re   zHoliday.datesZ  s   € Ø<?r'   c                ód  — t        |«      }t        |«      }|}|}| j                  �[t        t        | j                  | j                  | j                  «      «      }t        |g«      }|rt        | j                  |¬«      S |S | j                  ||«      }| j                  |«      }	| j                  �;|	t        j                  |	j                  | j                  «      j                  «          }	| j                  �/t!        | j                  j#                  |j$                  «      |«      }| j&                  �/t)        | j&                  j#                  |j$                  «      |«      }|	|	|k\  |	|k  z     }	| j*                  �|	j-                  | j*                  «      }	|rt        | j                  |	¬«      S |	S )aõ  
        Calculate holidays observed between start date and end date.

        Dates are computed from the rules defined for this holiday, i.e. its
        fixed ``year``/``month``/``day``, or its ``offset``/``observance``
        applied to each occurrence of ``month``/``day`` between the year
        before ``start_date`` and the year after ``end_date``.

        Parameters
        ----------
        start_date : starting date, datetime-like, optional
            The earliest date to consider in the search.
        end_date : ending date, datetime-like, optional
            The latest date to consider in the search.
        return_name : bool, optional, default=False
            If True, return a series that has dates and holiday names.
            False will only return dates.

        Returns
        -------
        Series or DatetimeIndex
            Series if return_name is True, otherwise a DatetimeIndex of
            the holiday's dates.

        See Also
        --------
        tseries.holiday.AbstractHolidayCalendar.holidays : Return a curve
            with holidays between start_date and end_date.

        Examples
        --------
        >>> from dateutil.relativedelta import MO
        >>> USMemorialDay = pd.tseries.holiday.Holiday(
        ...     "Memorial Day", month=5, day=31, offset=pd.DateOffset(weekday=MO(-1))
        ... )
        >>> USMemorialDay.dates("2020-01-01", "2021-12-31")
        DatetimeIndex(['2020-05-25', '2021-05-31'], dtype='datetime64[us]', freq=None)
        )Úindex)r   rR   r   rS   rT   r   r   rQ   Ú_reference_datesÚ_apply_rulerE   ÚnpÚisinÚday_of_weekÚravelrB   ÚmaxÚtz_localizeÚtzrC   ÚminrX   Ú
difference)
rY   rB   rC   rd   Úfilter_start_dateÚfilter_end_dater#   Údtire   Úholiday_datess
             r$   re   zHoliday.dates]  s‘  € ôR ˜zÓ*ˆ
Ü˜XÓ&ˆà&ÐØ"ˆà�9‰9Ð Üœ8 D§I¡I¨t¯z©z¸4¿8¹8ÓDÓEˆBÜ  Ó%ˆCÙÜ˜dŸi™i¨sÔ3Ð3à�
à×%Ñ% j°(Ó;ˆØ×(Ñ(¨Ó/ˆØ×ÑÐ(Ø)Ü—‘Ø!×-Ñ-Ø×%Ñ%ó÷ ‘%“'ñ	ˆMð �?‰?Ð&Ü #Ø—‘×+Ñ+Ð,=×,@Ñ,@ÓAÐCTó!Ðð �=‰=Ð$Ü!Ø—‘×)Ñ)¨/×*<Ñ*<Ó=¸óˆOð &ØÐ/Ñ/°MÀ_Ñ4TÑUñ
ˆð ×ÑÐ)Ø)×4Ñ4°T×5GÑ5GÓHˆMÙÜ˜$Ÿ)™)¨=Ô9Ð9ØÐr'   c                óð  — | j                   �%| j                   j                  |j                  «      }| j                  �%| j                  j                  |j                  «      }t	        d¬«      }t        t        |j                  dz
  | j                  | j                  «      «      }t        t        |j                  dz   | j                  | j                  «      «      }t        ||||j                  ¬«      }|S )a0  
        Get reference dates for the holiday.

        Return reference dates for the holiday also returning the year
        prior to the start_date and year following the end_date.  This ensures
        that any offsets to be applied will yield the holidays within
        the passed in dates.
        r   )Úyears)ÚstartÚendÚfreqrr   )rB   rq   rr   rC   r   r   r   rR   rS   rT   r   )rY   rB   rC   Úyear_offsetÚreference_start_dateÚreference_end_datere   s          r$   rj   zHoliday._reference_dates°  sÇ   € ð �?‰?Ð&ØŸ™×4Ñ4°Z·]±]ÓCˆJà�=‰=Ð$Ø—}‘}×0Ñ0°·±Ó?ˆHä  qÔ)ˆÜ(Ü�Z—_‘_ qÑ(¨$¯*©*°d·h±hÓ?ó 
Ðô 'Ü�X—]‘] QÑ&¨¯
©
°D·H±HÓ=ó
Ðô Ø&Ø"ØØ�}‰}ô	
ˆð ˆr'   c                óž  ‡ — |j                   r|j                  «       S ‰ j                  �|j                  ˆ fd„«      S ‰ j                  �wt        ‰ j                  t        «      s‰ j                  g}n‰ j                  }|D ]>  }t        j                  «       5  t        j                  dt        «       ||z  }ddd«       Œ@ |S # 1 sw Y   ŒLxY w)a  
        Apply the given offset/observance to a DatetimeIndex of dates.

        Parameters
        ----------
        dates : DatetimeIndex
            Dates to apply the given offset/observance rule

        Returns
        -------
        Dates with rules applied
        Nc                ó&   •— ‰j                  | «      S rH   )rV   )ÚdrY   s    €r$   ú<lambda>z%Holiday._apply_rule.<locals>.<lambda>ä  s   ø€  t§¡°qÓ'9€ r'   Úignore)ÚemptyÚcopyrV   ÚmaprU   rI   rN   ÚwarningsÚcatch_warningsÚsimplefilterr   )rY   re   ÚoffsetsrU   s   `   r$   rk   zHoliday._apply_ruleÓ  s¶   ø€ ð �;Š;Ø—:‘:“<Ðà�?‰?Ð&Ø—9‘9Ó9Ó:Ð:à�;‰;Ð"Ü˜dŸk™k¬4Ô0ØŸ;™;˜-‘àŸ+™+�Ø!ò $�ô ×,Ñ,Ó.ñ $Ü×)Ñ)¨(Ô4FÔGØ˜V‘O�E÷$ð $ð$ð ˆ÷$ð $ús   Â CÃC	)	NNNNNNNNN)rQ   ÚstrrU   z$BaseOffset | list[BaseOffset] | NonerV   z%Callable[[datetime], datetime] | NonerE   rD   rX   zDatetimeIndex | NoneÚreturnÚNone)rŽ   r�   )rd   zLiteral[True]rŽ   r   )rd   zLiteral[False]rŽ   r   )rŽ   r   ©F)rd   ÚboolrŽ   zSeries | DatetimeIndex)rB   r   rC   r   rŽ   r   )re   r   rŽ   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__rZ   r`   r   re   rj   rk   rb   r'   r$   rA   rA   Â  s  … ñNð` !Ó ØÓØ(Ó(ð
 ØØØ7;Ø<@ØØØ/3Ø.2ð*+àð*+ð 5ð*+ð :ð*+ð -ð*+ð ,ð*+ð 
ó*+óXð ÚTó ØTàðØ1?ðà	òó ðð Ú?ó Ø?ð 9>ðQØ15ðQà	óQðf!Ø#ð!Ø/8ð!à	ó!ôFr'   rA   z(dict[str, type[AbstractHolidayCalendar]]Úholiday_calendarsc                óf   — 	 | j                   }| t        |<   y# t        $ r | j                  }Y Œ!w xY w)aŠ  
    Add a holiday calendar class to the registry of named calendars.

    Calendar classes register themselves as soon as they are defined, so this
    is rarely called directly. A class is registered under its ``name``
    attribute if it has one and under its class name otherwise, and
    registering a class under a name that is already taken replaces the
    earlier one.

    See Also
    --------
    tseries.holiday.get_calendar : Return an instance of a calendar based on
        its name.
    tseries.holiday.HolidayCalendarFactory : Create a holiday calendar class
        from two sets of rules.
    tseries.holiday.AbstractHolidayCalendar : Abstract interface to create
        holidays following certain rules.

    Examples
    --------
    >>> from pandas.tseries.holiday import (
    ...     AbstractHolidayCalendar,
    ...     USLaborDay,
    ...     get_calendar,
    ...     register,
    ... )
    >>> class MyCalendar(AbstractHolidayCalendar):
    ...     rules = [USLaborDay]
    >>> MyCalendar.name = "us_labor_only"
    >>> register(MyCalendar)
    >>> [rule.name for rule in get_calendar("us_labor_only").rules]
    ['Labor Day']
    N)rQ   ÚAttributeErrorr’   r—   )ÚclsrQ   s     r$   Úregisterr›   ÷  s8   € ðDØ�x‰xˆð "Ô�dÒøô ò Ø�|‰|Šðús   ‚ ˜0¯0ÚAbstractHolidayCalendarc                ó   — t        |    «       S )aA  
    Return an instance of a calendar based on its name.

    The calendar class does not have to be kept around, since every calendar
    class is registered by name as soon as it is defined.

    Parameters
    ----------
    name : str
        Calendar name to return an instance of. This is the class name,
        unless the class sets a ``name`` attribute.

    Returns
    -------
    AbstractHolidayCalendar
        A new instance of the registered calendar class.

    Raises
    ------
    KeyError
        If no calendar is registered under ``name``.

    See Also
    --------
    tseries.holiday.register : Add a holiday calendar class to the registry
        of named calendars.
    tseries.holiday.HolidayCalendarFactory : Create a holiday calendar class
        from two sets of rules.
    tseries.holiday.AbstractHolidayCalendar : Abstract interface to create
        holidays following certain rules.

    Examples
    --------
    >>> from pandas.tseries.holiday import (
    ...     AbstractHolidayCalendar,
    ...     USLaborDay,
    ...     get_calendar,
    ... )
    >>> class MyCalendar(AbstractHolidayCalendar):
    ...     rules = [USLaborDay]
    >>> cal = get_calendar("MyCalendar")
    >>> cal.holidays(start="2020-01-01", end="2020-12-31")
    DatetimeIndex(['2020-09-07'], dtype='datetime64[us]', freq=None)
    )r—   )rQ   s    r$   Úget_calendarrž      s   € ôZ ˜TÑ"Ó$Ð$r'   c                  ó    ‡ — e Zd Zdˆ fd„Zˆ xZS )ÚHolidayCalendarMetaClassc                óB   •— t         ‰| �  | |||«      }t        |«       |S rH   )ÚsuperÚ__new__r›   )rš   ÚclsnameÚbasesÚattrsÚcalendar_classÚ	__class__s        €r$   r£   z HolidayCalendarMetaClass.__new__Q  s%   ø€ Ü™™¨¨g°u¸eÓDˆÜ�Ô ØÐr'   )r¤   r�   )r’   r“   r”   r£   Ú__classcell__©r¨   s   @r$   r    r    P  s   ø„ ÷ñ r'   r    c                  ó¸   ‡ — e Zd ZU dZg Zded<    e eddd«      «      Z e eddd«      «      Z	d	Z
d
ed<   ddˆ fd„Zdd„Z	 d	 	 	 dd„Zed„ «       Zddd„Zˆ xZS )rœ   aõ  
    Abstract interface to create holidays following certain rules.

    A subclass normally defines its holidays by setting ``rules`` to a list
    of :class:`~pandas.tseries.holiday.Holiday` instances directly on the
    class body. Alternatively, a set of rules can be passed to the
    constructor. The calendar can then be used to compute the holiday
    dates falling within a given date range via
    :meth:`~pandas.tseries.holiday.AbstractHolidayCalendar.holidays`.

    Parameters
    ----------
    name : str
        Name of the holiday calendar, defaults to class name.
    rules : array of Holiday objects
        A set of rules used to create the holidays.

    See Also
    --------
    tseries.holiday.Holiday : Class that defines a holiday with start/end
        dates and rules for observance.
    tseries.offsets.CustomBusinessDay : DateOffset subclass representing
        possibly n business days excluding holidays.

    Examples
    --------
    >>> from pandas.tseries.holiday import AbstractHolidayCalendar, USLaborDay
    >>> class MyCalendar(AbstractHolidayCalendar):
    ...     rules = [USLaborDay]
    >>> MyCalendar().holidays(start="2020-01-01", end="2020-12-31")
    DatetimeIndex(['2020-09-07'], dtype='datetime64[us]', freq=None)
    zlist[Holiday]Úrulesi²  r   i˜  é   é   Nz*tuple[Timestamp, Timestamp, Series] | NoneÚ_cachec                ór   •— t         ‰| �  «        |st        | «      j                  }|| _        |�|| _        y y rH   )r¢   rZ   Útyper’   rQ   r¬   )rY   rQ   r¬   r¨   s      €r$   rZ   z AbstractHolidayCalendar.__init__~  s9   ø€ Ü‰ÑÔÙÜ˜“:×&Ñ&ˆDØˆŒ	àÐØˆD�Jð r'   c                óL   — | j                   D ]  }|j                  |k(  sŒ|c S  y)aê  
        Return the rule for the holiday with the given name.

        Searches ``self.rules`` for a :class:`~pandas.tseries.holiday.Holiday`
        whose ``name`` attribute matches exactly.

        Parameters
        ----------
        name : str
            Name of the holiday whose rule should be returned.

        Returns
        -------
        Holiday or None
            The matching rule from ``self.rules``, or None if no rule with
            the given name is found.

        See Also
        --------
        tseries.holiday.AbstractHolidayCalendar.holidays : Return a curve
            with holidays between start_date and end_date.

        Examples
        --------
        >>> from pandas.tseries.holiday import AbstractHolidayCalendar, USLaborDay
        >>> class MyCalendar(AbstractHolidayCalendar):
        ...     rules = [USLaborDay]
        >>> MyCalendar().rule_from_name("Labor Day")
        Holiday: Labor Day (month=9, day=1, offset=<DateOffset: weekday=MO(+1)>)
        N©r¬   rQ   )rY   rQ   Úrules      r$   Úrule_from_namez&AbstractHolidayCalendar.rule_from_name‡  s-   € ð> —J‘Jò 	ˆDØ�y‰y˜DÓ Ø’ð	ð r'   c                ó  — | j                   €t        d| j                  › d�«      ‚|€t        j                  }|€t        j
                  }t        |«      }t        |«      }| j                  }|�||d   k  s||d   kD  rm| j                   D �cg c]  }|j                  ||d¬«      ‘Œ }}|rt        |«      }nt        t        g «      t        ¬«      }|||j                  «       f}|| _        |d   }||| }|r|S |j                  S c c}w )	a(  
        Return a curve with holidays between start_date and end_date.

        The holidays for the calendar are computed by evaluating the
        ``dates`` of each rule in ``self.rules`` and merging the results,
        caching them so that repeated calls covering a previously
        requested date range do not need to be recomputed.

        Parameters
        ----------
        start : starting date, datetime-like, optional
            The earliest date to consider, defaults to
            :attr:`AbstractHolidayCalendar.start_date`.
        end : ending date, datetime-like, optional
            The latest date to consider, defaults to
            :attr:`AbstractHolidayCalendar.end_date`.
        return_name : bool, optional
            If True, return a series that has dates and holiday names.
            False will only return a DatetimeIndex of dates.

        Returns
        -------
        DatetimeIndex or Series
            DatetimeIndex of holidays, or a Series mapping holiday dates to
            their names if ``return_name`` is True.

        See Also
        --------
        tseries.holiday.Holiday.dates : Calculate holidays observed between
            start date and end date.

        Examples
        --------
        >>> from pandas.tseries.holiday import AbstractHolidayCalendar, USLaborDay
        >>> class MyCalendar(AbstractHolidayCalendar):
        ...     rules = [USLaborDay]
        >>> MyCalendar().holidays(start="2020-01-01", end="2020-12-31")
        DatetimeIndex(['2020-09-07'], dtype='datetime64[us]', freq=None)
        zHoliday Calendar z" does not have any rules specifiedr   r   T)rd   )ri   Údtyper   )r¬   Ú	ExceptionrQ   rœ   rB   rC   r   r¯   re   r   r   r   ÚobjectÚ
sort_indexri   )rY   r{   r|   rd   Úcacher´   Úpre_holidaysÚholidayss           r$   r½   z AbstractHolidayCalendar.holidays¬  s  € ðT �:‰:ÐÜØ# D§I¡I ;Ð.PÐQóð ð ˆ=Ü+×6Ñ6ˆEàˆ;Ü)×2Ñ2ˆCä˜%Ó ˆÜ˜‹nˆð —‘ˆØˆ=˜E E¨!¡HÒ,°°e¸A±h²àEIÇZÁZöØ=A�—
‘
˜5 #°4�
Õ8ðˆLð ñ Ü! ,Ó/‘ä!¬°bÓ(9ÄÔH�à˜C ×!4Ñ!4Ó!6Ð7ˆEØˆDŒKà˜‘8ˆØ˜E #Ð&ˆáØˆOà—>‘>Ð!ùò#s   ÂDc                óŽ  — 	 |j                   }t        |t        «      s|g}|D �ci c]  }|j                  |“Œ }}	 | j                   } t        | t        «      s| g} | D �ci c]  }|j                  |“Œ }}|j                  |«       t        |j                  «       «      S # t        $ r Y Œœw xY wc c}w # t        $ r Y Œvw xY wc c}w )a#  
        Merge holiday calendars together.

        The base calendar will take precedence to other. The merge will be
        done based on each holiday's name.

        Parameters
        ----------
        base : AbstractHolidayCalendar
            Instance/subclass or array of Holiday objects.
        other : AbstractHolidayCalendar
            Instance/subclass or array of Holiday objects.

        Returns
        -------
        list of Holiday
            Combined list of holidays from both calendars, with ``base``
            taking precedence over ``other`` for holidays sharing the
            same name.

        See Also
        --------
        tseries.holiday.AbstractHolidayCalendar.merge : Merge holiday
            calendars together.

        Examples
        --------
        >>> from pandas.tseries.holiday import (
        ...     AbstractHolidayCalendar,
        ...     USLaborDay,
        ...     USMemorialDay,
        ... )
        >>> class Calendar1(AbstractHolidayCalendar):
        ...     rules = [USMemorialDay]
        >>> class Calendar2(AbstractHolidayCalendar):
        ...     rules = [USLaborDay]
        >>> merged = AbstractHolidayCalendar.merge_class(Calendar1, Calendar2)
        >>> [holiday.name for holiday in merged]
        ['Labor Day', 'Memorial Day']
        )r¬   r™   rI   rN   rQ   ÚupdateÚvalues)ÚbaseÚotherÚholidayÚother_holidaysÚbase_holidayss        r$   Úmerge_classz#AbstractHolidayCalendar.merge_classû  sÑ   € ðT	Ø—K‘KˆEô ˜%¤Ô&Ø�GˆEØ?DÖE°G˜'Ÿ,™,¨Ñ/ÐEˆÐEð	Ø—:‘:ˆDô ˜$¤Ô%Ø�6ˆDØ>BÖC°7˜Ÿ™ wÑ.ÐCˆÐCà×Ñ˜mÔ,Ü�N×)Ñ)Ó+Ó,Ð,øô# ò 	Ùð	üò
 Føô ò 	Ùð	üò
 Ds-   ‚B ¥B.¼B3 ÁCÂ	B+Â*B+Â3	B?Â>B?c                ó>   — | j                  | |«      }|r|| _        y|S )a  
        Merge holiday calendars together.

        The caller's class rules take precedence. The merge will be done
        based on each holiday's name.

        Parameters
        ----------
        other : holiday calendar
            Calendar, instance/subclass, or array of Holiday objects to
            merge into this calendar's rules.
        inplace : bool (default=False)
            If True set rule_table to holidays, else return array of
            Holidays.

        Returns
        -------
        list of Holiday or None
            The combined list of holidays if ``inplace`` is False,
            otherwise None.

        See Also
        --------
        tseries.holiday.AbstractHolidayCalendar.merge_class : Merge holiday
            calendars together.

        Examples
        --------
        >>> from pandas.tseries.holiday import (
        ...     AbstractHolidayCalendar,
        ...     USLaborDay,
        ...     USMemorialDay,
        ... )
        >>> class Calendar1(AbstractHolidayCalendar):
        ...     rules = [USMemorialDay]
        >>> class Calendar2(AbstractHolidayCalendar):
        ...     rules = [USLaborDay]
        >>> merged = Calendar1().merge(Calendar2())
        >>> [holiday.name for holiday in merged]
        ['Labor Day', 'Memorial Day']
        N)rÆ   r¬   )rY   rÂ   Úinplacer½   s       r$   ÚmergezAbstractHolidayCalendar.merge:  s&   € ðT ×#Ñ# D¨%Ó0ˆÙØ!ˆD�JàˆOr'   )r\   N)rQ   r�   rŽ   r�   )rQ   r�   rŽ   zHoliday | None)NNF)rd   r‘   rŽ   zDatetimeIndex | Seriesr�   )rÈ   r‘   )r’   r“   r”   r•   r¬   r–   r   r   rB   rC   r¯   rZ   rµ   r½   ÚstaticmethodrÆ   rÉ   r©   rª   s   @r$   rœ   rœ   W  sŽ   ø… ñðB €Eˆ=ÓÙ™8 D¨!¨QÓ/Ó0€JÙ™ $¨¨BÓ/Ó0€HØ9=€FÐ6Ó=öó#ðL 9>ðM"Ø15ðM"à	óM"ð^ ñ<-ó ð<-÷|.ð .r'   )Ú	metaclasszMemorial Dayr   r®   éÿÿÿÿ)r!   )rS   rT   rU   z	Labor Dayé	   r   zColumbus Dayé
   r   zThanksgiving Dayé   r6   z#Birthday of Martin Luther King, Jr.iÂ  é   )rB   rS   rT   rU   zWashington's BirthdayzGood FridayéþÿÿÿzEaster Mondayc                  ó�   — e Zd ZdZ eddde¬«      eee edddde¬	«       ed
dde¬«      e	e
 eddde¬«      e eddde¬«      gZy)ÚUSFederalHolidayCalendaraä  
    US Federal Government holiday calendar.

    The rules follow the federal holiday schedule published by the US Office
    of Personnel Management:
    https://www.opm.gov/policy-data-oversight/pay-leave/federal-holidays/

    Holidays that land on a weekend are observed on the nearest weekday.
    Pass an instance as the ``calendar`` argument of
    :class:`~pandas.tseries.offsets.CustomBusinessDay` to skip these dates
    in business day arithmetic.

    Parameters
    ----------
    name : str
        Name of the holiday calendar, defaults to class name.
    rules : array of Holiday objects
        A set of rules used to create the holidays.

    See Also
    --------
    tseries.holiday.AbstractHolidayCalendar : Abstract interface to create
        holidays following certain rules.
    tseries.holiday.nearest_workday : Move Saturday to Friday and Sunday to
        Monday.
    tseries.holiday.get_calendar : Return an instance of a calendar based on
        its name.

    Examples
    --------
    >>> from pandas.tseries.holiday import USFederalHolidayCalendar
    >>> USFederalHolidayCalendar().holidays(start="2024-06-01", end="2024-07-31")
    DatetimeIndex(['2024-06-19', '2024-07-04'], dtype='datetime64[us]', freq=None)
    zNew Year's Dayr   )rS   rT   rV   z$Juneteenth National Independence Dayr   é   z
2021-06-18)rS   rT   rB   rV   zIndependence Dayé   r6   zVeterans DayrÏ   zChristmas Dayr­   é   N)r’   r“   r”   r•   rA   r2   ÚUSMartinLutherKingJrÚUSPresidentsDayÚUSMemorialDayÚ
USLaborDayÚUSColumbusDayÚUSThanksgivingDayr¬   rb   r'   r$   rÓ   rÓ   „  sv   „ ñ!ñH 	Ð ¨¨q¸_ÔMØØØÙØ2ØØØ#Ø&ô	
ñ 	Ð"¨!°¸ÔOØØÙ� b¨b¸_ÔMØÙ� r¨r¸oÔNð#�Er'   rÓ   c                óT   — t         j                  ||«      }t        | |f|| dœ«      }|S )a“  
    Create a holiday calendar class from two sets of rules.

    The rules of ``base`` and ``other`` are merged by holiday name, with
    ``base`` winning any clash, and the result becomes the ``rules`` of a new
    calendar class. That class registers itself under ``name``, so
    :func:`~pandas.tseries.holiday.get_calendar` can find it later.

    Parameters
    ----------
    name : str
        Name of the calendar class to create.
    base : AbstractHolidayCalendar
        Instance/subclass or array of Holiday objects whose rules take
        precedence.
    other : AbstractHolidayCalendar
        Instance/subclass or array of Holiday objects to merge into ``base``.
    base_class : type, default AbstractHolidayCalendar
        The class the new calendar class inherits from.

    Returns
    -------
    type
        A new subclass of ``base_class`` holding the merged rules.

    See Also
    --------
    tseries.holiday.AbstractHolidayCalendar.merge_class : Merge holiday
        calendars together.
    tseries.holiday.get_calendar : Return an instance of a calendar based on
        its name.
    tseries.holiday.register : Add a holiday calendar class to the registry
        of named calendars.

    Examples
    --------
    >>> from pandas.tseries.holiday import (
    ...     AbstractHolidayCalendar,
    ...     HolidayCalendarFactory,
    ...     USLaborDay,
    ...     USMemorialDay,
    ... )
    >>> class MyCalendar(AbstractHolidayCalendar):
    ...     rules = [USMemorialDay]
    >>> NewCalendar = HolidayCalendarFactory("NewCalendar", MyCalendar, USLaborDay)
    >>> [rule.name for rule in NewCalendar.rules]
    ['Labor Day', 'Memorial Day']
    r³   )rœ   rÆ   r±   )rQ   rÁ   rÂ   Ú
base_classr¬   r§   s         r$   ÚHolidayCalendarFactoryrß   ½  s2   € ôb $×/Ñ/°°eÓ<€EÜ˜$  ¸ÈÑ/MÓN€NØÐr'   )r	   r
   r   r   r   r   r   rß   r?   r=   rž   r2   r%   r*   r8   r,   r;   r›   r.   r0   )r#   r   rŽ   r   )rŽ   r�   )rQ   r�   rŽ   rœ   )rQ   r�   )@Ú
__future__r   r   r   Útypingr   r   r   r‰   Údateutil.relativedeltar	   r
   r   r   r   r   r   Únumpyrl   Úpandas._libs.tslibs.offsetsr   Úpandas.errorsr   Úpandasr   r   r   r   r   r   Úpandas.tseries.offsetsr   r   Úcollections.abcr   r%   r*   r,   r.   r0   r2   r8   r;   r=   r?   rA   r—   r–   r›   rž   r±   r    rœ   rÙ   rÚ   rÛ   rÜ   r×   rØ   Ú
GoodFridayÚEasterMondayrÓ   rß   Ú__all__rb   r'   r$   ú<module>rì      sæ  ðÞ "÷÷ñ ó
 ÷÷ ñ ó å 2Ý ,÷÷ ÷ñ
 Ý(ó&óR*óZ%óP$óN&óR&óR'óT'óT"1óJ!-÷Hoñ oðd	 ?AÐ Ð;Ó @ó&"óR-%ô`˜tô ôQÐ(@õ Qñh Ø˜! ©J¹rÀ"»vÔ,Fô€ñ �[¨¨q¹ÉBÈqËEÔ9RÔS€
ÙØ˜" !©J¹rÀ!»uÔ,Eô€ñ Ø˜b a±
Á2ÀaÃ5Ô0IôÐ ñ Ø)Ù˜˜a Ó#Ø
Ø	Ù™b ›eÔ$ôÐ ñ Ø 1¨!±JÁrÈ!ÃuÔ4Mô€ñ �]¨!°¹F»HÁcÈ"ÃgÐ;NÔO€
á�¨a°QÁÃÉ#ÈaË&Ð?QÔR€ô6Ð6ô 6ðr ?Vô 3òl�r'   