# Path: src/bin/syndication_app/feedparser/datetimes/w3dtf.py
# def _parse_date_w3dtf(datestr):
#     if not datestr.strip():
#         return None
#     parts = datestr.lower().split('t')
#     if len(parts) == 1:
#         # This may be a date only, or may be an MSSQL-style date
#         parts = parts[0].split()
#         if len(parts) == 1:
#             # Treat this as a date only
#             parts.append('00:00:00z')
#     elif len(parts) > 2:
#         return None
#     date = parts[0].split('-', 2)
#     if not date or len(date[0]) != 4:
#         return None
#     # Ensure that `date` has 3 elements. Using '1' sets the default
#     # month to January and the default day to the 1st of the month.
#     date.extend(['1'] * (3 - len(date)))
#     try:
#         year, month, day = [int(i) for i in date]
#     except ValueError:
#         # `date` may have more than 3 elements or may contain
#         # non-integer strings.
#         return None
#     if parts[1].endswith('z'):
#         parts[1] = parts[1][:-1]
#         parts.append('z')
#     # Append the numeric timezone offset, if any, to parts.
#     # If this is an MSSQL-style date then parts[2] already contains
#     # the timezone information, so `append()` will not affect it.
#     # Add 1 to each value so that if `find()` returns -1 it will be
#     # treated as False.
#     loc = parts[1].find('-') + 1 or parts[1].find('+') + 1 or len(parts[1]) + 1
#     loc = loc - 1
#     parts.append(parts[1][loc:])
#     parts[1] = parts[1][:loc]
#     time = parts[1].split(':', 2)
#     # Ensure that time has 3 elements. Using '0' means that the
#     # minutes and seconds, if missing, will default to 0.
#     time.extend(['0'] * (3 - len(time)))
#     if parts[2][:1] in ('-', '+'):
#         try:
#             tzhour = int(parts[2][1:3])
#             tzmin = int(parts[2][4:])
#         except ValueError:
#             return None
#         if parts[2].startswith('-'):
#             tzhour = tzhour * -1
#             tzmin = tzmin * -1
#     else:
#         tzhour = timezonenames.get(parts[2], 0)
#         tzmin = 0
#     try:
#         hour, minute, second = [int(float(i)) for i in time]
#     except ValueError:
#         return None
#     # Create the datetime object and timezone delta objects
#     try:
#         stamp = datetime.datetime(year, month, day, hour, minute, second)
#     except ValueError:
#         return None
#     delta = datetime.timedelta(0, 0, 0, 0, tzmin, tzhour)
#     # Return the date and timestamp in a UTC 9-tuple
#     try:
#         return (stamp - delta).utctimetuple()
#     except (OverflowError, ValueError):
#         # IronPython throws ValueErrors instead of OverflowErrors
#         return None


import re
from .w3dtf import _parse_date_w3dtf
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import absolute_import
from __future__ import unicode_literals



# 8-bit date handling routines written by ytrewq1.
_korean_year = '\ub144' # b3e2 in euc-kr
_korean_month = '\uc6d4' # bff9 in euc-kr
_korean_day = '\uc77c' # c0cf in euc-kr
_korean_am = '\uc624\uc804' # bfc0 c0fc in euc-kr
_korean_pm = '\uc624\ud6c4' # bfc0 c8c4 in euc-kr

_korean_onblog_date_re = re.compile(
    r'(\d{4})%s\s+(\d{2})%s\s+(\d{2})%s\s+(\d{2}):(\d{2}):(\d{2})'
    % (_korean_year, _korean_month, _korean_day)
)

_korean_nate_date_re = re.compile(

# Path: src/bin/syndication_app/feedparser/datetimes/w3dtf.py
# def _parse_date_w3dtf(datestr):
#     if not datestr.strip():
#         return None
#     parts = datestr.lower().split('t')
#     if len(parts) == 1:
#         # This may be a date only, or may be an MSSQL-style date
#         parts = parts[0].split()
#         if len(parts) == 1:
#             # Treat this as a date only
#             parts.append('00:00:00z')
#     elif len(parts) > 2:
#         return None
#     date = parts[0].split('-', 2)
#     if not date or len(date[0]) != 4:
#         return None
#     # Ensure that `date` has 3 elements. Using '1' sets the default
#     # month to January and the default day to the 1st of the month.
#     date.extend(['1'] * (3 - len(date)))
#     try:
#         year, month, day = [int(i) for i in date]
#     except ValueError:
#         # `date` may have more than 3 elements or may contain
#         # non-integer strings.
#         return None
#     if parts[1].endswith('z'):
#         parts[1] = parts[1][:-1]
#         parts.append('z')
#     # Append the numeric timezone offset, if any, to parts.
#     # If this is an MSSQL-style date then parts[2] already contains
#     # the timezone information, so `append()` will not affect it.
#     # Add 1 to each value so that if `find()` returns -1 it will be
#     # treated as False.
#     loc = parts[1].find('-') + 1 or parts[1].find('+') + 1 or len(parts[1]) + 1
#     loc = loc - 1
#     parts.append(parts[1][loc:])
#     parts[1] = parts[1][:loc]
#     time = parts[1].split(':', 2)
#     # Ensure that time has 3 elements. Using '0' means that the
#     # minutes and seconds, if missing, will default to 0.
#     time.extend(['0'] * (3 - len(time)))
#     if parts[2][:1] in ('-', '+'):
#         try:
#             tzhour = int(parts[2][1:3])
#             tzmin = int(parts[2][4:])
#         except ValueError:
#             return None
#         if parts[2].startswith('-'):
#             tzhour = tzhour * -1
#             tzmin = tzmin * -1
#     else:
#         tzhour = timezonenames.get(parts[2], 0)
#         tzmin = 0
#     try:
#         hour, minute, second = [int(float(i)) for i in time]
#     except ValueError:
#         return None
#     # Create the datetime object and timezone delta objects
#     try:
#         stamp = datetime.datetime(year, month, day, hour, minute, second)
#     except ValueError:
#         return None
#     delta = datetime.timedelta(0, 0, 0, 0, tzmin, tzhour)
#     # Return the date and timestamp in a UTC 9-tuple
#     try:
#         return (stamp - delta).utctimetuple()
#     except (OverflowError, ValueError):
#         # IronPython throws ValueErrors instead of OverflowErrors
#         return None


# Path: src/bin/syndication_app/feedparser/datetimes/korean.py
import re
from .w3dtf import _parse_date_w3dtf

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

from __future__ import absolute_import
from __future__ import unicode_literals



# 8-bit date handling routines written by ytrewq1.
_korean_year = '\ub144' # b3e2 in euc-kr
_korean_month = '\uc6d4' # bff9 in euc-kr
_korean_day = '\uc77c' # c0cf in euc-kr
_korean_am = '\uc624\uc804' # bfc0 c0fc in euc-kr
_korean_pm = '\uc624\ud6c4' # bfc0 c8c4 in euc-kr

_korean_onblog_date_re = re.compile(
    r'(\d{4})%s\s+(\d{2})%s\s+(\d{2})%s\s+(\d{2}):(\d{2}):(\d{2})'
    % (_korean_year, _korean_month, _korean_day)
)

_korean_nate_date_re = re.compile(

    r'(\d{4})-(\d{2})-(\d{2})\s+(%s|%s)\s+(\d{,2}):(\d{,2}):(\d{,2})'