lol

python3Packages.dateparser: fix regex compatibility

Patch by thmo (THomas Moschny) taken from
https://github.com/scrapinghub/dateparser/issues/1045#issuecomment-1129846022.

Also relaxes the regex version constraint.

+19
+8
pkgs/development/python-modules/dateparser/default.nix
··· 29 29 sha256 = "sha256-bDup3q93Zq+pvwsy/lQy2byOMjG6C/+7813hWQMbZRU="; 30 30 }; 31 31 32 + patches = [ 33 + ./regex-compat.patch 34 + ]; 35 + 32 36 postPatch = '' 37 + substituteInPlace setup.py --replace \ 38 + 'regex !=2019.02.19,!=2021.8.27,<2022.3.15' \ 39 + 'regex' 40 + 33 41 # https://github.com/scrapinghub/dateparser/issues/1053 34 42 substituteInPlace tests/test_search.py --replace \ 35 43 "('June 2020', datetime.datetime(2020, 6, datetime.datetime.utcnow().day, 0, 0))," \
+11
pkgs/development/python-modules/dateparser/regex-compat.patch
··· 1 + --- a/dateparser/languages/locale.py 2 + +++ b/dateparser/languages/locale.py 3 + @@ -169,7 +169,7 @@ class Locale: 4 + if normalize: 5 + value = list(map(normalize_unicode, value)) 6 + pattern = '|'.join(sorted(value, key=len, reverse=True)) 7 + - pattern = DIGIT_GROUP_PATTERN.sub(r'?P<n>\d+', pattern) 8 + + pattern = pattern.replace(r'\d+', r'?P<n>\d+') 9 + pattern = re.compile(r'^(?:{})$'.format(pattern), re.UNICODE | re.IGNORECASE) 10 + relative_dictionary[pattern] = key 11 + return relative_dictionary