From 1c43aed5dd84c8009e0925b6634144186c6a792d Mon Sep 17 00:00:00 2001 From: Alex Hall Date: Fri, 26 Aug 2022 20:30:17 +0200 Subject: [PATCH] (core) Upgrade sortedcontainers, python_dateutil, and html5lib for better Python 3.10 compatibility Summary: Based on https://github.com/gristlabs/grist-core/pull/251. It may not look like it, but there's very little going on in this diff: - Tweak the DATEVALUE doctest for Python 2/3 compatibility. - Mirrors the PR's changes to requirements3.txt in requirements.txt, i.e. make the same dependency upgrades in Python 2. - Make the same upgrades in the thirdparty folder for the Python 2 nacl sandbox. Test Plan: Updated one doctest for dateutil. Checked changelog of sortedcontainers. html5lib is only used by messytables and isn't actually relevant. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D3609 --- sandbox/grist/functions/date.py | 7 ++++++- sandbox/requirements.txt | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sandbox/grist/functions/date.py b/sandbox/grist/functions/date.py index 5a24340a..def2b81d 100644 --- a/sandbox/grist/functions/date.py +++ b/sandbox/grist/functions/date.py @@ -292,11 +292,16 @@ def DATEVALUE(date_string, tz=None): >>> DATEVALUE("asdf") Traceback (most recent call last): ... - dateutil.parser._parser.ParserError: Unknown string format: asdf + {}: Unknown string format: asdf """ return dateutil.parser.parse(date_string).replace(tzinfo=_get_tzinfo(tz)) +DATEVALUE.__doc__ = DATEVALUE.__doc__.format( + "dateutil.parser._parser.ParserError" if six.PY3 else "ParserError" +) + + def DAY(date): """ Returns the day of a date, as an integer ranging from 1 to 31. Same as `date.day`. diff --git a/sandbox/requirements.txt b/sandbox/requirements.txt index 492eb4c7..49a32d01 100644 --- a/sandbox/requirements.txt +++ b/sandbox/requirements.txt @@ -4,7 +4,7 @@ backports.functools-lru-cache==1.6.4 chardet==4.0.0 enum34==1.1.10 et-xmlfile==1.0.1 -html5lib==0.999999999 +html5lib==1.1 iso8601==0.1.12 jdcal==1.4.1 json_table_schema==0.2.1 @@ -12,12 +12,12 @@ lazy_object_proxy==1.6.0 lxml==4.6.3 # used in csv plugin only? messytables==0.15.2 openpyxl==2.6.4 -python_dateutil==2.6.0 +python_dateutil==2.8.2 python_magic==0.4.12 roman==2.0.0 singledispatch==3.6.2 six==1.16.0 -sortedcontainers==1.5.7 +sortedcontainers==2.4.0 webencodings==0.5 wrapt==1.12.1 xlrd==1.2.0