Update dateutil 2.8.1 (c496b4f) → 2.8.2 (28da62d).

This commit is contained in:
JackDandy 2023-01-14 14:31:48 +00:00
parent a7e3e56982
commit 6daffc36de
5 changed files with 30 additions and 14 deletions

View file

@ -8,6 +8,7 @@
* Update Msgpack 1.0.0 (fa7d744) to 1.0.4 (b5acfd5) * Update Msgpack 1.0.0 (fa7d744) to 1.0.4 (b5acfd5)
* Update certifi 2022.09.24 to 2022.12.07 * Update certifi 2022.09.24 to 2022.12.07
* Update chardet packages 4.0.0 (b3d867a) to 5.1.0 (8087f00) * Update chardet packages 4.0.0 (b3d867a) to 5.1.0 (8087f00)
* Update dateutil 2.8.1 (c496b4f) to 2.8.2 (28da62d)
* Update diskcache 5.1.0 (40ce0de) to 5.4.0 (1cb1425) * Update diskcache 5.1.0 (40ce0de) to 5.4.0 (1cb1425)
* Update feedparser 6.0.1 (98d189fa) to 6.0.10 (5fcb3ae) * Update feedparser 6.0.1 (98d189fa) to 6.0.10 (5fcb3ae)
* Update functools_lru_cache 1.6.1 (2dc65b5) to 1.6.2 (2405ed1) * Update functools_lru_cache 1.6.1 (2dc65b5) to 1.6.2 (2405ed1)

View file

@ -1,4 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys
try: try:
from ._version import version as __version__ from ._version import version as __version__
except ImportError: except ImportError:
@ -6,3 +8,17 @@ except ImportError:
__all__ = ['easter', 'parser', 'relativedelta', 'rrule', 'tz', __all__ = ['easter', 'parser', 'relativedelta', 'rrule', 'tz',
'utils', 'zoneinfo'] 'utils', 'zoneinfo']
def __getattr__(name):
import importlib
if name in __all__:
return importlib.import_module("." + name, __name__)
raise AttributeError(
"module {!r} has not attribute {!r}".format(__name__, name)
)
def __dir__():
# __dir__ should include all the lazy-importable modules as well.
return [x for x in globals() if x not in sys.modules] + __all__

View file

@ -60,14 +60,8 @@ class _timelex(object):
_split_decimal = re.compile("([.,])") _split_decimal = re.compile("([.,])")
def __init__(self, instream): def __init__(self, instream):
if six.PY2: if isinstance(instream, (bytes, bytearray)):
# In Python 2, we can't duck type properly because unicode has instream = instream.decode()
# a 'decode' function, and we'd be double-decoding
if isinstance(instream, (bytes, bytearray)):
instream = instream.decode()
else:
if getattr(instream, 'decode', None) is not None:
instream = instream.decode()
if isinstance(instream, text_type): if isinstance(instream, text_type):
instream = StringIO(instream) instream = StringIO(instream)

View file

@ -159,7 +159,7 @@ class isoparser(object):
components, pos = self._parse_isodate(datestr) components, pos = self._parse_isodate(datestr)
if pos < len(datestr): if pos < len(datestr):
raise ValueError('String contains unknown ISO ' + raise ValueError('String contains unknown ISO ' +
'components: {}'.format(datestr)) 'components: {!r}'.format(datestr.decode('ascii')))
return date(*components) return date(*components)
@_takes_ascii @_takes_ascii
@ -333,10 +333,10 @@ class isoparser(object):
pos = 0 pos = 0
comp = -1 comp = -1
if len(timestr) < 2: if len_str < 2:
raise ValueError('ISO time too short') raise ValueError('ISO time too short')
has_sep = len_str >= 3 and timestr[2:3] == self._TIME_SEP has_sep = False
while pos < len_str and comp < 5: while pos < len_str and comp < 5:
comp += 1 comp += 1
@ -347,13 +347,18 @@ class isoparser(object):
pos = len_str pos = len_str
break break
if comp == 1 and timestr[pos:pos+1] == self._TIME_SEP:
has_sep = True
pos += 1
elif comp == 2 and has_sep:
if timestr[pos:pos+1] != self._TIME_SEP:
raise ValueError('Inconsistent use of colon separator')
pos += 1
if comp < 3: if comp < 3:
# Hour, minute, second # Hour, minute, second
components[comp] = int(timestr[pos:pos + 2]) components[comp] = int(timestr[pos:pos + 2])
pos += 2 pos += 2
if (has_sep and pos < len_str and
timestr[pos:pos + 1] == self._TIME_SEP):
pos += 1
if comp == 3: if comp == 3:
# Fraction of a second # Fraction of a second

Binary file not shown.