Skip to content

Commit 027ca61

Browse files
authored
Fix strings with illegal escape sequences (#161)
1 parent e0bb38e commit 027ca61

File tree

14 files changed

+34
-29
lines changed

14 files changed

+34
-29
lines changed

DenominoViso/DenominoViso.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2314,7 +2314,7 @@ def get_javascript_functions(self):
23142314
var x = persons[i].getAttribute('x')
23152315
var y = persons[i].getAttribute('y')
23162316
} else {
2317-
/^M(-?\d+),(-?\d+)/.exec(persons[i].getAttribute('d'))
2317+
/^M(-?\\d+),(-?\\d+)/.exec(persons[i].getAttribute('d'))
23182318
var x = RegExp.$1
23192319
var y = RegExp.$2
23202320
}

DescendantsLines/DescendantsLines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ def add_menu_options(self, menu):
15021502
category_name = _("Display")
15031503

15041504
namedisp = StringOption(_("Name Display Format"),
1505-
"$n(f L){ \($n(n)\)}")
1505+
r"$n(f L){ \($n(n)\)}")
15061506
namedisp.set_help(
15071507
_("f=first & middle names, l=surname, n=nickname,"
15081508
"\nc=commonly used given name, t=title, s=suffix,"

Differences/differences.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def format_struct_path(self, path):
215215
if retval:
216216
retval += ", "
217217
if "[" in part and "]" in part:
218-
part, index = re.match("(.*)\[(\d*)\]", part).groups()
218+
part, index = re.match(r"(.*)\[(\d*)\]", part).groups()
219219
retval += "%s #%s" % (part.replace("_", " "), int(index) + 1)
220220
else:
221221
retval += part

ExportProlog/ExportProlog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def exportData(db, filename,
5656
fp.write("grandparent(X, Y) :- parent(X, Z), parent(Z, Y).\n")
5757
fp.write("ancestor(X, Y) :- parent(X, Y).\n")
5858
fp.write("ancestor(X, Y) :- parent(X, Z), ancestor(Z, Y).\n")
59-
fp.write("sibling(X, Y) :- parent(Z, X), parent(Z, Y), X \= Y.\n")
59+
fp.write("sibling(X, Y) :- parent(Z, X), parent(Z, Y), X \\= Y.\n")
6060

6161
# ---------------------------------
6262
# Notes

ExtractCity/extractcity.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@
5757
from gramps.gui.utils import ProgressMeter
5858
from gramps.gui.glade import Glade
5959

60-
CITY_STATE_ZIP = re.compile("((\w|\s)+)\s*,\s*((\w|\s)+)\s*(,\s*((\d|-)+))", re.UNICODE)
61-
CITY_STATE = re.compile("((?:\w|\s)+(?:-(?:\w|\s)+)*),((?:\w|\s)+)", re.UNICODE)
62-
CITY_LAEN = re.compile("((?:\w|\s)+(?:-(?:\w|\s)+)*)\(((?:\w|\s)+)", re.UNICODE)
63-
STATE_ZIP = re.compile("(.+)\s+([\d-]+)", re.UNICODE)
60+
CITY_STATE_ZIP = re.compile(r"((\w|\s)+)\s*,\s*((\w|\s)+)\s*(,\s*((\d|-)+))",
61+
re.UNICODE)
62+
CITY_STATE = re.compile(r"((?:\w|\s)+(?:-(?:\w|\s)+)*),((?:\w|\s)+)",
63+
re.UNICODE)
64+
CITY_LAEN = re.compile(r"((?:\w|\s)+(?:-(?:\w|\s)+)*)\(((?:\w|\s)+)",
65+
re.UNICODE)
66+
STATE_ZIP = re.compile(r"(.+)\s+([\d-]+)", re.UNICODE)
6467

6568
COUNTRY = ( _("United States of America"), _("Canada"), _("France"),_("Sweden"))
6669

GoogleEarthWriteKML/GoogleEarthWriteKML.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,21 @@
7171
# Check i googleearth is installed
7272
_GOOGLEEARTH_OK = False
7373
if os.sys.platform == 'win32':
74-
FILE_PATH = '"%s\Google\Google Earth\googleearth.exe"'\
75-
% (os.getenv('ProgramFiles'))
74+
FILE_PATH = r'"%s\Google\Google Earth\googleearth.exe"'\
75+
% (os.getenv('ProgramFiles'))
7676
NORM_PATH = os.path.normpath(FILE_PATH)
7777
_GOOGLEEARTH_OK = search_for(NORM_PATH)
7878

7979
if not _GOOGLEEARTH_OK:
8080
# For Win 7 with 32 Gramps
81-
FILE_PATH = '"%s\Google\Google Earth\client\googleearth.exe"'\
81+
FILE_PATH = r'"%s\Google\Google Earth\client\googleearth.exe"'\
8282
% (os.getenv('ProgramFiles'))
8383
NORM_PATH = os.path.normpath(FILE_PATH)
8484
_GOOGLEEARTH_OK = search_for(NORM_PATH)
8585

8686
if not _GOOGLEEARTH_OK:
8787
# For Win 7 with 64 Gramps, need to find path to 32 bits programs
88-
FILE_PATH = '"%s\Google\Google Earth\client\googleearth.exe"'\
88+
FILE_PATH = r'"%s\Google\Google Earth\client\googleearth.exe"'\
8989
% (os.getenv('ProgramFiles(x86)'))
9090
NORM_PATH = os.path.normpath(FILE_PATH)
9191
_GOOGLEEARTH_OK = search_for(NORM_PATH)

HeadlineNewsGramplet/HeadlineNewsGramplet.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def substitute(match):
7474
return match.group()
7575

7676
def decode_html(string):
77-
entity_re = re.compile("&(#?)(\d{1,5}|\w{1,8});")
77+
entity_re = re.compile(r"&(#?)(\d{1,5}|\w{1,8});")
7878
return entity_re.subn(substitute, string)[0]
7979

8080
#------------------------------------------------------------------------
@@ -238,28 +238,28 @@ def decode_wiki(self, text):
238238
newtext = ""
239239
text = text.replace(oldtext, newtext)
240240
### Internal wiki URL with title:
241-
pattern = re.compile('\[\[(.*?)\|(.*?)\]\]')
241+
pattern = re.compile(r'\[\[(.*?)\|(.*?)\]\]')
242242
matches = pattern.findall(text)
243243
for (g1, g2) in matches:
244244
text = text.replace("[[%s|%s]]" % (g1, g2),
245245
("""<A HREF="%s">%s</A>""" %
246246
(self.wiki(g1), self.nice_title(g2))))
247247
### Internal wiki URL:
248-
pattern = re.compile('\[\[(.*?)\]\]')
248+
pattern = re.compile(r'\[\[(.*?)\]\]')
249249
matches = pattern.findall(text)
250250
for match in matches:
251251
text = text.replace("[[%s]]" % match,
252252
("""<A HREF="%s">%s</A>""" %
253253
(self.wiki(match), self.nice_title(match))))
254254
### URL with title:
255-
pattern = re.compile('\[http\:\/\/(.*?) (.*?)\]')
255+
pattern = re.compile(r'\[http\:\/\/(.*?) (.*?)\]')
256256
matches = pattern.findall(text)
257257
for (g1, g2) in matches:
258258
text = text.replace("[http://%s %s]" % (g1, g2),
259259
("""<A HREF="http://%s">%s</A>""" %
260260
(g1, g2)))
261261
### URL:
262-
pattern = re.compile('\[http\:\/\/(.*?)\]')
262+
pattern = re.compile(r'\[http\:\/\/(.*?)\]')
263263
matches = pattern.findall(text)
264264
count = 1
265265
for g1 in matches:

PrerequisitesCheckerGramplet/PrerequisitesCheckerGramplet.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ def check26_htmlview(self):
11431143
#self.append_text("\n")
11441144

11451145
def check27_googlemapkml(self):
1146-
'''GoogleMapKML - Needs Google Earth Desktop Program installed to view locations
1146+
r'''GoogleMapKML - Needs Google Earth Desktop Program installed to view locations
11471147
11481148
https://www.google.com/earth/desktop/
11491149
[x]Google Earth Standard:
@@ -1181,23 +1181,23 @@ def check27_googlemapkml(self):
11811181
_GOOGLEEARTH_OK = False
11821182
_GOOGLEEARTH_STATUS = "Not found."
11831183
if os.sys.platform == 'win32':
1184-
FILE_PATH = '"%s\Google\Google Earth\googleearth.exe"'\
1184+
FILE_PATH = r'"%s\Google\Google Earth\googleearth.exe"'\
11851185
% (os.getenv('ProgramFiles'))
11861186
NORM_PATH = os.path.normpath(FILE_PATH)
11871187
_GOOGLEEARTH_OK = search_for(NORM_PATH)
11881188
_GOOGLEEARTH_STATUS = "Standard. found."
11891189

11901190
if not _GOOGLEEARTH_OK:
11911191
# For Win 7 with 32 Gramps
1192-
FILE_PATH = '"%s\Google\Google Earth\client\googleearth.exe"'\
1192+
FILE_PATH = r'"%s\Google\Google Earth\client\googleearth.exe"'\
11931193
% (os.getenv('ProgramFiles'))
11941194
NORM_PATH = os.path.normpath(FILE_PATH)
11951195
_GOOGLEEARTH_OK = search_for(NORM_PATH)
11961196
_GOOGLEEARTH_STATUS = "Standard. found2."
11971197

11981198
if not _GOOGLEEARTH_OK:
11991199
# For Win 7 with 64 Gramps, need to find path to 32 bits programs
1200-
FILE_PATH = '"%s\Google\Google Earth\client\googleearth.exe"'\
1200+
FILE_PATH = r'"%s\Google\Google Earth\client\googleearth.exe"'\
12011201
% (os.getenv('ProgramFiles(x86)'))
12021202
NORM_PATH = os.path.normpath(FILE_PATH)
12031203
_GOOGLEEARTH_OK = search_for(NORM_PATH)
@@ -1570,7 +1570,8 @@ def intltool_version():
15701570
import subprocess
15711571

15721572
if sys.platform == 'win32':
1573-
cmd = ["perl", "-e print qx(intltool-update --version) =~ m/(\d+.\d+.\d+)/;"]
1573+
cmd = ["perl", "-e print qx(intltool-update --version) =~ "
1574+
r"m/(\d+.\d+.\d+)/;"]
15741575
try:
15751576
ver, ret = subprocess.Popen(cmd ,stdout=subprocess.PIPE,
15761577
stderr=subprocess.PIPE, shell=True).communicate()

SourceIndex/birth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def __init__(self, dbstate, user, options_class, name, callback=None):
206206

207207

208208
def _setup_fields(self):
209-
'''
209+
r'''
210210
Gramps XML storage means ability to also import/manage alone records
211211
/!\ some attributes are translated keys
212212
see data_item keys and eventref types of attribute

SourceIndex/census.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def __getitem__(self, key):
142142
return self.glade.get_widget(key)
143143

144144
def _setup_fields(self):
145-
'''
145+
r'''
146146
Gramps XML storage means ability to also import/manage alone records
147147
/!\ some attributes are translated keys
148148
see data_item keys and eventref types of attribute

0 commit comments

Comments
 (0)