+
    =i3                         R t ^ RIHtHtHtHt ^ RIt^ RIHt ^ RIH	t	 ^ RI
t
^ RItRR.tR t ! R R]4      t]! 4       t]P"                  tR# )	z
This module offers a parser for ISO-8601 strings

It is intended to support all valid date, time and datetime formats per the
ISO-8601 specification.

..versionadded:: 2.7.0
)datetime	timedeltatimedateN)tzwrapsisoparse	isoparserc                 0   a  \        S 4      V 3R  l4       pV# )c                 $  <a \        SR V3R l4      ! 4       o\        S\        P                  4      '       d    SP	                  R4      oS! V S.VO5/ VB #   \
         d-   pRp\        P                  ! \        T4      T4        Rp?L?Rp?ii ; i)readc                     < S # N )str_ins   |/Users/tonyclaw/.openclaw/workspace/scripts/youtube-playlists/venv/lib/python3.14/site-packages/dateutil/parser/isoparser.py<lambda>,_takes_ascii.<locals>.func.<locals>.<lambda>   s        asciiz5ISO-8601 strings should contain only ASCII charactersN)getattr
isinstancesix	text_typeencodeUnicodeEncodeError
raise_from
ValueError)selfr   argskwargsemsgfs   &f*,  r   func_takes_ascii.<locals>.func   s     8: fcmm,,3w/
 v////	 & 3Mz#223s   A B#"B

Br   )r$   r%   s   f r   _takes_asciir'      s     
1X0 0 Kr   c                      a  ] tR t^*t o RR lt]R 4       t]R 4       t]R 4       t]RR l4       t	Rt
Rt]P                  ! R	4      tR
 tR tR tR tR tRR ltRtV tR# )r
   Nc                    VeD   \        V4      ^8w  g   \        V4      ^8  g   VR9   d   \        R4      hVP                  R4      pWn        R# )z
:param sep:
    A single character that separates date and time portions. If
    ``None``, the parser will accept any single character.
    For strict ISO-8601 adherence, pass ``'T'``.
N
0123456789r   z7Separator must be a single, non-numeric ASCII character)lenordr   r   _sep)r   seps   &&r   __init__isoparser.__init__+   sL     ?CASSC<4G  "3 4 4 **W%C	r   c                |   V P                  V4      w  r#\        V4      V8  dU   V P                  e   WV^,            V P                  8X  d"   W P                  W^,           R 4      ,          pM\	        R4      h\        V4      ^8  d.   V^,          ^8X  d    ^ V^&   \        V!  \        ^R7      ,           # \        V!  # )u  
Parse an ISO-8601 datetime string into a :class:`datetime.datetime`.

An ISO-8601 datetime string consists of a date portion, followed
optionally by a time portion - the date and time portions are separated
by a single character separator, which is ``T`` in the official
standard. Incomplete date formats (such as ``YYYY-MM``) may *not* be
combined with a time portion.

Supported date formats are:

Common:

- ``YYYY``
- ``YYYY-MM``
- ``YYYY-MM-DD`` or ``YYYYMMDD``

Uncommon:

- ``YYYY-Www`` or ``YYYYWww`` - ISO week (day defaults to 0)
- ``YYYY-Www-D`` or ``YYYYWwwD`` - ISO week and day

The ISO week and day numbering follows the same logic as
:func:`datetime.date.isocalendar`.

Supported time formats are:

- ``hh``
- ``hh:mm`` or ``hhmm``
- ``hh:mm:ss`` or ``hhmmss``
- ``hh:mm:ss.ssssss`` (Up to 6 sub-second digits)

Midnight is a special case for `hh`, as the standard supports both
00:00 and 24:00 as a representation. The decimal separator can be
either a dot or a comma.


.. caution::

    Support for fractional components other than seconds is part of the
    ISO-8601 standard, but is not currently implemented in this parser.

Supported time zone offset formats are:

- `Z` (UTC)
- `±HH:MM`
- `±HHMM`
- `±HH`

Offsets will be represented as :class:`dateutil.tz.tzoffset` objects,
with the exception of UTC, which will be represented as
:class:`dateutil.tz.tzutc`. Time zone offsets equivalent to UTC (such
as `+00:00`) will also be represented as :class:`dateutil.tz.tzutc`.

:param dt_str:
    A string or stream containing only an ISO-8601 datetime string

:return:
    Returns a :class:`datetime.datetime` representing the string.
    Unspecified components default to their lowest value.

.. warning::

    As of version 2.7.0, the strictness of the parser should not be
    considered a stable part of the contract. Any valid ISO-8601 string
    that parses correctly with the default settings will continue to
    parse correctly in future versions, but invalid strings that
    currently fail (e.g. ``2017-01-01T00:00+00:00:00``) are not
    guaranteed to continue failing in future versions if they encode
    a valid date.

.. versionadded:: 2.7.0
Nz&String contains unknown ISO componentsdays)_parse_isodater+   r-   _parse_isotimer   r   r   )r   dt_str
componentsposs   &&  r   r	   isoparser.isoparse;   s    V --f5
v;yy FsQw$7499$D11&q2BCC
 !IJJz?Q:a=B#6JqMZ(9!+<<<$$r   c                    V P                  V4      w  r#V\        V4      8  d1   \        RRP                  VP	                  R4      4      ,           4      h\        V!  # )z
Parse the date portion of an ISO string.

:param datestr:
    The string portion of an ISO string, without a separator

:return:
    Returns a :class:`datetime.date` object
zString contains unknown ISO zcomponents: {!r}r   )r4   r+   r   formatdecoder   )r   datestrr7   r8   s   &&  r   parse_isodateisoparser.parse_isodate   s\     --g6
W;/66w~~g7NOP Q QZ  r   c                \    V P                  V4      pV^ ,          ^8X  d   ^ V^ &   \        V!  # )z
Parse the time portion of an ISO string.

:param timestr:
    The time portion of an ISO string, without a separator

:return:
    Returns a :class:`datetime.time` object
)r5   r   )r   timestrr7   s   && r   parse_isotimeisoparser.parse_isotime   s4     ((1
a=BJqMZ  r   c                &    V P                  WR7      # )a  
Parse a valid ISO time zone string.

See :func:`isoparser.isoparse` for details on supported formats.

:param tzstr:
    A string representing an ISO time zone offset

:param zero_as_utc:
    Whether to return :class:`dateutil.tz.tzutc` for zero-offset zones

:return:
    Returns :class:`dateutil.tz.tzoffset` for offsets and
    :class:`dateutil.tz.tzutc` for ``Z`` and (if ``zero_as_utc`` is
    specified) offsets equivalent to UTC.
)zero_as_utc)_parse_tzstr)r   tzstrrE   s   &&&r   parse_tzstrisoparser.parse_tzstr   s    $    @@r      -   :s   [\.,]([0-9]+)c                j     V P                  V4      #   \         d    T P                  T4      u # i ; ir   )_parse_isodate_commonr   _parse_isodate_uncommon)r   r6   s   &&r   r4   isoparser._parse_isodate   s8    	8--f55 	8//77	8s    22c                \   \        V4      p. ROpV^8  d   \        R4      h\        VR,          4      V^ &   ^pWB8  d   W43# WV^,            V P                  8H  pV'       d
   V^,          pW$,
          ^8  d   \        R4      h\        WV^,            4      V^&   V^,          pWB8  d   V'       d   W43# \        R4      hV'       d/   WV^,            V P                  8w  d   \        R4      hV^,          pW$,
          ^8  d   \        R4      h\        WV^,            4      V^&   W4^,           3# )   ISO string too short       NzInvalid common monthzInvalid ISO formatzInvalid separator in ISO stringzInvalid common day)rQ   rQ   rQ   )r+   r   int	_DATE_SEP)r   r6   len_strr7   r8   has_seps   &&    r   rM   isoparser._parse_isodate_common   s)   f+
Q;344 F3K(
1>?"S1W%71HC =1344FsQw/0
1q>!& !566#'"dnn4 !BCC1HC =1122FsQw/0
17""r   c                   \        V4      ^8  d   \        R4      h\        VR,          4      pVR,          V P                  8H  p^V,           pWV^,            R8X  d   V^,          p\        WV^,            4      pV^,          p^p\        V4      V8  dN   WV^,            V P                  8H  V8w  d   \        R4      hWC,          p\        WV^,            4      pV^,          pV P	                  W%V4      pM\        V4      V,
          ^8  d   \        R4      h\        WV^,            4      pV^,          pV^8  g#   VR\
        P                  ! V4      ,           8  d"   \        RRP                  W4      ,           4      h\        V^^4      \        V^,
          R	7      ,           pVP                  VP                  VP                  .p	W3# )
rU   rR   rS   :rU      N   Wz"Inconsistent use of dash separatorzInvalid ordinal dayim  z {} for year {}r2   )r+   r   rV   rW   _calculate_weekdatecalendarisleapr;   r   r   yearmonthday)
r   r6   ra   rY   r8   weeknodayno	base_dateordinal_dayr7   s
   &&        r   rN   !isoparser._parse_isodate_uncommon   s   v;?344 6#;+/'kcAg$&1HCC!G,-F1HCE6{S sQw'4>>9gE$%IJJFsQw/0q00uEI 6{S 1$ !677fq12K1HCQ+xt7L1L"M !6!2!9!9+!L"M N N T1a(9+/+JJInniooy}}E
r   c                   ^ Tu;8  d   ^68  g   M \        RP                  V4      4      h^ Tu;8  d   ^8  g   M \        RP                  V4      4      h\        V^^4      pV\        VP	                  4       ^,          ^,
          R7      ,
          pV^,
          ^,          V^,
          ,           pV\        VR7      ,           # )a  
Calculate the day of corresponding to the ISO year-week-day calendar.

This function is effectively the inverse of
:func:`datetime.date.isocalendar`.

:param year:
    The year in the ISO calendar

:param week:
    The week in the ISO calendar - range is [1, 53]

:param day:
    The day in the ISO calendar - range is [1 (MON), 7 (SUN)]

:return:
    Returns a :class:`datetime.date`
zInvalid week: {}zInvalid weekday: {}r2   )r   r;   r   r   isocalendar)r   ra   weekrc   jan_4week_1week_offsets   &&&&   r   r^   isoparser._calculate_weekdate)  s    & 4}"}/66t<==3{{299#>?? T1a (9(9(;A(>(BCC ax1na0	{333r   c                
   \        V4      p. ROp^ pRpV^8  d   \        R4      hRpWB8  Edc   V^8  Ed[   V^,          pWV^,            R9   d   V P                  WR 4      VR&   TpEM'V^8X  d'   WV^,            V P                  8X  d   RpV^,          pM=V^8X  d7   V'       d/   WV^,            V P                  8w  d   \        R4      hV^,          pV^8  d    \	        WV^,            4      W5&   V^,          pV^8X  g   K  V P
                  P                  WR 4      pV'       g   EK  VP                  ^4      R,          p\	        V4      ^
^\        V4      ,
          ,          ,          W5&   V\        VP                  4       4      ,          pEKi  WB8  d   \        R4      hV^ ,          ^8X  dT   \        ;QJ d#    R	 VR
,           4       F  '       g   K   RM	  RM! R	 VR
,           4       4      '       d   \        R4      hV# )rT   NzISO time too shortFs   -+ZzTz#Inconsistent use of colon separator:N   NzUnused components in ISO stringc              3   *   "   T F	  q^ 8g  x  K  	  R# 5i)rT   Nr   ).0	components   & r   	<genexpr>+isoparser._parse_isotime.<locals>.<genexpr>z  s     C?i>?s   :rQ   rU   Nz#Hour may only be 24 at 24:00:00.000)rT   rT   rT   rT   N)	r+   r   rF   	_TIME_SEPrV   _FRACTION_REGEXmatchgroupany)	r   rA   rX   r7   r8   comprY   fracus_strs	   &&       r   r5   isoparser._parse_isotimeJ  s   g,'
Q;122mqAID37#w.!%!2!274=!A
2qyWQ/4>>Aqws1u%7$%JKKqax#&w37';#<
 qqy++11'$-@Ar*#&v;a#f+o1F#F
 s4::<((=>??a=BsC:c?CsssC:c?CCC !FGGr   c                ^   VR 8X  g   VR8X  d   \         P                  # \        V4      R9  d   \        R4      hVR,          R8X  d   RpMVR,          R8X  d   ^pM\        R4      h\	        VR,          4      p\        V4      ^8X  d   ^ pM'\	        YR,          V P
                  8X  d   ^M^R	 4      pV'       d   V^ 8X  d   V^ 8X  d   \         P                  # V^;8  d   \        R
4      hV^8  d   \        R4      h\         P                  ! R	W4^<,          V,           ,          ^<,          4      # )   Z   zz0Time zone offset must be 1, 3, 5 or 6 characters:rT   rQ   NrJ      +zTime zone offset requires sign:rQ      N:r   rU   NNz#Invalid minutes in time zone offsetz!Invalid hours in time zone offset>   r   r\   rq   rw   )r   UTCr+   r   rV   rx   tzoffset)r   rG   rE   multhoursminutess   &&&   r   rF   isoparser._parse_tzstr  s    D=ETM66Mu:Y&OPP:D3Z4D=>>E#Ju:?G%CjDNN&B KLMG5A:'Q,66M| !FGGrz !DEE;;tTRZ'-A%BR%GHHr   )r-   r   )T)__name__
__module____qualname____firstlineno__r/   r'   r	   r>   rB   rH   rW   rx   recompilery   r4   rM   rN   r^   r5   rF   __static_attributes____classdictcell__)__classdict__s   @r   r
   r
   *   s       V% V%p ! !  ! ! A A( IIjj!23O8'#R*X4B3jI Ir   )__doc__r   r   r   r   r_   dateutilr   	functoolsr   r   r   __all__r'   objectr
   DEFAULT_ISOPARSERr	   r   r   r   <module>r      sV    5 4    	 
{
#(rI rIj K %%r   