summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-07-20 14:07:35 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-07-20 20:25:17 +0200
commitbdedc84127530fcf71c096ad572bd4306a40b26f (patch)
tree194bd6b26b495b252d907afef4c8e50dd53078b8
parentd4a80b15edc905f6e1213fa8d95300b8299fffec (diff)
Fix "invalid escape sequence \w" Python exceptions
(Like > Python exception: <class 'SyntaxError'>: invalid escape sequence \w (lightproof_impl_en.py, line 126), traceback follows > File "instdir/program/pythonloader.py", line 133, in activate > mod = self.getModuleFromUrl( locationUrl ) > File "instdir/program/pythonloader.py", line 101, in getModuleFromUrl > exec(codeobject, mod.__dict__) > File "instdir/share/extensions/dict-en/Lightproof.py", line 6, in <module> > from lightproof_impl_en import locales > File "instdir/program/uno.py", line 345, in _uno_import > return _builtin_import(name, *optargs, **kwargs) I noticed e.g. during UITest_writer_tests3.) Appears those suspicious escapes were present ever since 2214a3731aaffc4a51d1c712dbee553a0ba35af0 "Hungarian sentence checking", 95445a70a29c6a1166a19f483566f2c9cfc7563b "English sentence checking", and c9cdf3fb4752e8b0c641a3aff15d554135beb0e7 "Add Russian grammar checking + update English and Hungarian". Change-Id: Ia2af7e0adb00b4737b22d460dd75fa47a4ae70d5 Reviewed-on: https://gerrit.libreoffice.org/c/dictionaries/+/99047 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--en/pythonpath/lightproof_impl_en.py4
-rw-r--r--hu_HU/pythonpath/lightproof_impl_hu_HU.py4
-rw-r--r--ru_RU/pythonpath/lightproof_impl_ru_RU.py4
3 files changed, 6 insertions, 6 deletions
diff --git a/en/pythonpath/lightproof_impl_en.py b/en/pythonpath/lightproof_impl_en.py
index ac668dc..06d44a6 100644
--- a/en/pythonpath/lightproof_impl_en.py
+++ b/en/pythonpath/lightproof_impl_en.py
@@ -123,14 +123,14 @@ def suggest(rLoc, word):
# get the nth word of the input string or None
def word(s, n):
- a = re.match("(?u)( [-.\w%%]+){" + str(n-1) + "}( [-.\w%%]+)", s)
+ a = re.match("(?u)( [-.\\w%%]+){" + str(n-1) + "}( [-.\\w%%]+)", s)
if not a:
return ''
return a.group(2)[1:]
# get the (-)nth word of the input string or None
def wordmin(s, n):
- a = re.search("(?u)([-.\w%%]+ )([-.\w%%]+ ){" + str(n-1) + "}$", s)
+ a = re.search("(?u)([-.\\w%%]+ )([-.\\w%%]+ ){" + str(n-1) + "}$", s)
if not a:
return ''
return a.group(1)[:-1]
diff --git a/hu_HU/pythonpath/lightproof_impl_hu_HU.py b/hu_HU/pythonpath/lightproof_impl_hu_HU.py
index e933129..ef8fb0a 100644
--- a/hu_HU/pythonpath/lightproof_impl_hu_HU.py
+++ b/hu_HU/pythonpath/lightproof_impl_hu_HU.py
@@ -126,14 +126,14 @@ def suggest(rLoc, word):
# get the nth word of the input string or None
def word(s, n):
- a = re.match("(?u)( [-.\w%%]+){" + str(n-1) + "}( [-.\w%%]+)", s)
+ a = re.match("(?u)( [-.\\w%%]+){" + str(n-1) + "}( [-.\\w%%]+)", s)
if not a:
return ''
return a.group(2)[1:]
# get the (-)nth word of the input string or None
def wordmin(s, n):
- a = re.search("(?u)([-.\w%%]+ )([-.\w%%]+ ){" + str(n-1) + "}$", s)
+ a = re.search("(?u)([-.\\w%%]+ )([-.\\w%%]+ ){" + str(n-1) + "}$", s)
if not a:
return ''
return a.group(1)[:-1]
diff --git a/ru_RU/pythonpath/lightproof_impl_ru_RU.py b/ru_RU/pythonpath/lightproof_impl_ru_RU.py
index 22eb59e..ffbf054 100644
--- a/ru_RU/pythonpath/lightproof_impl_ru_RU.py
+++ b/ru_RU/pythonpath/lightproof_impl_ru_RU.py
@@ -125,14 +125,14 @@ def suggest(rLoc, word):
# get the nth word of the input string or None
def word(s, n):
- a = re.match("(?u)( [-.\w%%]+){" + str(n-1) + "}( [-.\w%%]+)", s)
+ a = re.match("(?u)( [-.\\w%%]+){" + str(n-1) + "}( [-.\\w%%]+)", s)
if not a:
return ''
return a.group(2)[1:]
# get the (-)nth word of the input string or None
def wordmin(s, n):
- a = re.search("(?u)([-.\w%%]+ )([-.\w%%]+ ){" + str(n-1) + "}$", s)
+ a = re.search("(?u)([-.\\w%%]+ )([-.\\w%%]+ ){" + str(n-1) + "}$", s)
if not a:
return ''
return a.group(1)[:-1]