mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-25 17:55:21 +00:00
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.
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
--- a/dateparser/languages/locale.py
|
||||
+++ b/dateparser/languages/locale.py
|
||||
@@ -169,7 +169,7 @@ class Locale:
|
||||
if normalize:
|
||||
value = list(map(normalize_unicode, value))
|
||||
pattern = '|'.join(sorted(value, key=len, reverse=True))
|
||||
- pattern = DIGIT_GROUP_PATTERN.sub(r'?P<n>\d+', pattern)
|
||||
+ pattern = pattern.replace(r'\d+', r'?P<n>\d+')
|
||||
pattern = re.compile(r'^(?:{})$'.format(pattern), re.UNICODE | re.IGNORECASE)
|
||||
relative_dictionary[pattern] = key
|
||||
return relative_dictionary
|
||||
Reference in New Issue
Block a user