
    Mh2                         S SK Jr  S SKJr  S SKJrJrJr  \" S 5      rSS/rS r	\
" \S5      (       a  SS jrO " S	 S
\5      rSS jrS r " S S\5      r " S S\5      rg)    )PY2wraps)datetime	timedeltatzinfotzname_in_python2enfoldc                 J   ^  [         (       a  [        T 5      U 4S j5       nU$ T $ )zChange unicode output into bytestrings in Python 2

tzname() API changed in Python 3. It used to return bytes, but was changed
to unicode strings
c                  >   > T" U 0 UD6nUb  UR                  5       nU$ N)encode)argskwargsnamenamefuncs      E/var/www/html/env/lib/python3.13/site-packages/dateutil/tz/_common.pyadjust_encoding*tzname_in_python2.<locals>.adjust_encoding   s(    T,V,D{{}K    )r   r   )r   r   s   ` r   r	   r	      s-     s	x	 
	 r   foldc                      U R                  US9$ )F  
Provides a unified interface for assigning the ``fold`` attribute to
datetimes both before and after the implementation of PEP-495.

:param fold:
    The value for the ``fold`` attribute in the returned datetime. This
    should be either 0 or 1.

:return:
    Returns an object for which ``getattr(dt, 'fold', 0)`` returns
    ``fold`` for all versions of Python. In versions prior to
    Python 3.6, this is a ``_DatetimeWithFold`` object, which is a
    subclass of :py:class:`datetime.datetime` with the ``fold``
    attribute added, if ``fold`` is 1.

.. versionadded:: 2.6.0
r   replace)dtr   s     r   r
   r
   %   s    $ zztz$$r   c                   2    \ rS rSrSrSrS r\S 5       rSr	g)_DatetimeWithFold:   z
This is a class designed to provide a PEP 495-compliant interface for
Python versions before 3.6. It is used only for dates in a fold, so
the ``fold`` attribute is fixed at ``1``.

.. versionadded:: 2.6.0
 c                    Sn[        X5       H(  u  pEXR;   a  [        SR                  U5      5      eXBU'   M*     U H  nXR;  d  M
  [        X5      X%'   M     UR	                  SS5      (       a  U R
                  O[        nU" S0 UD6$ )a  
Return a datetime with the same attributes, except for those
attributes given new values by whichever keyword arguments are
specified. Note that tzinfo=None can be specified to create a naive
datetime from an aware datetime with no conversion of date and time
data.

This is reimplemented in ``_DatetimeWithFold`` because pypy3 will
return a ``datetime.datetime`` even if ``fold`` is unchanged.
)yearmonthdayhourminutesecondmicrosecondr   zDuplicate argument: {}r      r!   )zip	TypeErrorformatgetattrget	__class__r   )selfr   r   argnamesargargnamedt_classs          r   r   _DatetimeWithFold.replaceD   s    H
 !$D 3$#$<$C$CG$LMM"%w	 !4 $(&-d&<FO $ *0FA)>)>t~~HH%f%%r   c                     g)Nr*   r!   r1   s    r   r   _DatetimeWithFold.foldb   s    r   N)
__name__
__module____qualname____firstlineno____doc__	__slots__r   propertyr   __static_attributes__r!   r   r   r   r   :   s'    	 		&< 
	 
	r   r   c                     [        U SS5      U:X  a  U $ U R                  5       SS nX R                  U R                  4-  nU(       a  [	        U6 $ [        U6 $ )r   r   r   N   )r.   	timetupler)   r   r   r   )r   r   r   s      r   r
   r
   f   sY    $ 2vq!T)I||~bq!++$d++T?"r   c                 0   ^  [        T 5      U 4S j5       nU$ )z
The CPython version of ``fromutc`` checks that the input is a ``datetime``
object and that ``self`` is attached as its ``tzinfo``.
c                    > [        U[        5      (       d  [        S5      eUR                  U La  [	        S5      eT" X5      $ )N&fromutc() requires a datetime argumentdt.tzinfo is not self)
isinstancer   r,   r   
ValueError)r1   r   fs     r   fromutc)_validate_fromutc_inputs.<locals>.fromutc   s>    "h''DEE99D 455{r   r   )rK   rL   s   ` r   _validate_fromutc_inputsrN      s"    
 1X  Nr   c                   @    \ rS rSrSrS rS rS rS r\	S 5       r
Srg	)
_tzinfo   z5
Base class for all ``dateutil`` ``tzinfo`` objects.
c                     UR                  U S9n[        USS9n[        USS9nUR                  5       UR                  5       :H  nUR                  SS9UR                  SS9:H  nU=(       a    U(       + $ )
Whether or not the "wall time" of a given datetime is ambiguous in this
zone.

:param dt:
    A :py:class:`datetime.datetime`, naive or time zone aware.


:return:
    Returns ``True`` if ambiguous, ``False`` otherwise.

.. versionadded:: 2.6.0
r   r   r   r*   N)r   r
   	utcoffset)r1   r   wall_0wall_1same_offsetsame_dts         r   is_ambiguous_tzinfo.is_ambiguous   su     ZZtZ$##&&(F,<,<,>>...-t1LL*{?*r   c                     U R                  U5      (       a2  X!-
  n[        X1R                  5       UR                  5       -
  :H  5      nU$ SnU$ )aX  
Determine the fold status of a "wall" datetime, given a representation
of the same datetime as a (naive) UTC datetime. This is calculated based
on the assumption that ``dt.utcoffset() - dt.dst()`` is constant for all
datetimes, and that this offset is the actual number of hours separating
``dt_utc`` and ``dt_wall``.

:param dt_utc:
    Representation of the datetime as UTC

:param dt_wall:
    Representation of the datetime as "wall time". This parameter must
    either have a `fold` attribute or have a fold-naive
    :class:`datetime.tzinfo` attached, otherwise the calculation may
    fail.
r   )rZ   intrU   dst)r1   dt_utcdt_wall
delta_wall_folds        r   _fold_status_tzinfo._fold_status   sQ    " W%% )J
'7'7'9FJJL'HIJE  Er   c                     [        USS5      $ )Nr   r   )r.   r1   r   s     r   rb   _tzinfo._fold   s    r61%%r   c                     UR                  5       nUc  [        S5      eUR                  5       nUc  [        S5      eX#-
  nX-  n[        USS9R                  5       nUc  [        S5      eX-   $ )  
Given a timezone-aware datetime in a given timezone, calculates a
timezone-aware datetime in a new timezone.

Since this is the one time that we *know* we have an unambiguous
datetime object, we take this opportunity to determine whether the
datetime is ambiguous and in a "fold" state (e.g. if it's the first
occurrence, chronologically, of the ambiguous datetime).

:param dt:
    A timezone-aware :class:`datetime.datetime` object.
z0fromutc() requires a non-None utcoffset() resultz*fromutc() requires a non-None dst() resultr*   r   z;fromutc(): dt.dst gave inconsistent results; cannot convert)rU   rJ   r^   r
   )r1   r   dtoffdtdstdeltas        r   _fromutc_tzinfo._fromutc   s     = & ' ' =IJJ
 r"&&(= 7 8 8zr   c                 X    U R                  U5      nU R                  X5      n[        X#S9$ )ri   r   )rm   rc   r
   )r1   r   r`   rb   s       r   rL   _tzinfo.fromutc   s1     --# !!". g**r   r!   N)r:   r;   r<   r=   r>   rZ   rc   rb   rm   rN   rL   rA   r!   r   r   rP   rP      s0    +22&#J + +r   rP   c                       \ rS rSrSrS rS rS r\S 5       r	S r
S rS	 rS
 r\S 5       rSrS rS r\R(                  rSrg)tzrangebasei  aG  
This is an abstract base class for time zones represented by an annual
transition into and out of DST. Child classes should implement the following
methods:

    * ``__init__(self, *args, **kwargs)``
    * ``transitions(self, year)`` - this is expected to return a tuple of
      datetimes representing the DST on and off transitions in standard
      time.

A fully initialized ``tzrangebase`` subclass should also provide the
following attributes:
    * ``hasdst``: Boolean whether or not the zone uses DST.
    * ``_dst_offset`` / ``_std_offset``: :class:`datetime.timedelta` objects
      representing the respective UTC offsets.
    * ``_dst_abbr`` / ``_std_abbr``: Strings representing the timezone short
      abbreviations in DST and STD, respectively.
    * ``_hasdst``: Whether or not the zone has DST.

.. versionadded:: 2.6.0
c                     [        S5      e)Nz%tzrangebase is an abstract base class)NotImplementedErrorr8   s    r   __init__tzrangebase.__init__!  s    !"IJJr   c                 j    U R                  U5      nUc  g U(       a  U R                  $ U R                  $ r   )_isdst_dst_offset_std_offsetr1   r   isdsts      r   rU   tzrangebase.utcoffset$  s2    B=######r   c                 ^    U R                  U5      nUc  g U(       a  U R                  $ [        $ r   )rx   _dst_base_offsetZEROr{   s      r   r^   tzrangebase.dst.  s+    B=(((Kr   c                 ^    U R                  U5      (       a  U R                  $ U R                  $ r   )rx   	_dst_abbr	_std_abbrrf   s     r   tznametzrangebase.tzname8  s#    ;;r??>>!>>!r   c                    [        U[        5      (       d  [        S5      eUR                  U La  [	        S5      eU R                  UR                  5      nUc  XR                  U5      -   $ Uu  p4X0R                  -  nX@R                  -  nX44nUR                  SS9nU R                  Xe5      nU(       a  XR                  -   nOXR                  -   n[        U(       + =(       a    U R                  U5      5      n	[        XS9$ )z+Given a datetime in UTC, return local time rG   rH   NrT   r   )rI   r   r,   r   rJ   transitionsr#   rU   rz   r   _naive_isdstry   r]   rZ   r
   )
r1   r   r   dstondstoffutc_transitionsr_   r|   r`   rb   s
             r   rL   tzrangebase.fromutc?  s    "h''DEE99D 455 &&rww/r*** $!!!""" /4(!!&:+++G+++GI<$"3"3G"<=g**r   c                     U R                   (       d  gU R                  UR                  5      u  p#UR                  SS9nX1s=:*  =(       a    X0R                  -   :  $ s  $ )rS   FNrT   )hasdstr   r#   r   r   )r1   r   startends       r   rZ   tzrangebase.is_ambiguous`  sT     {{%%bgg.
ZZtZ$77C"7"777878r   c                    U R                   (       d  gUc  g U R                  UR                  5      nUc  gUR                  S S9nU R	                  X5      nU(       d,  U R                  U5      (       a  U R                  U5      (       + $ U$ )NFrT   )r   r   r#   r   r   rZ   rb   )r1   r   r   r|   s       r   rx   tzrangebase._isdstv  s|    {{Z&&rww/ZZtZ$!!"2 **2..zz"~%%Lr   c                     Uu  p4UR                  S S9nX4:  a  X1s=:*  =(       a    U:  nU$ s  nU$ XAs=:*  =(       a    U:  Os  (       + nU$ )NrT   r   )r1   r   r   r   r   r|   s         r   r   tzrangebase._naive_isdst  s]    #ZZtZ$>((&(E 	 )E  ,,u,,Er   c                 4    U R                   U R                  -
  $ r   )ry   rz   r8   s    r   r   tzrangebase._dst_base_offset  s    $"2"222r   Nc                     X:X  + $ r   r!   )r1   others     r   __ne__tzrangebase.__ne__  s    ""r   c                 4    SU R                   R                  -  $ )Nz%s(...))r0   r:   r8   s    r   __repr__tzrangebase.__repr__  s    4>>2222r   r!   )r:   r;   r<   r=   r>   ru   rU   r^   r	   r   rL   rZ   rx   r   r@   r   __hash__r   r   object
__reduce__rA   r!   r   r   rr   rr     sr    *K$ " "+B9,*
 3 3 H#3 ""Jr   rr   N)r*   )sixr   	functoolsr   r   r   r   r   __all__r	   hasattrr
   r   rN   rP   rr   r!   r   r   <module>r      ss      0 0 |
), 8V%**H *X#<"s+f s+lX#' X#r   