Skip to content

Commit 954a164

Browse files
committed
Fix invalid escape syntax warnings
Additionally use rawstrings with all regex calls
1 parent 1ea6136 commit 954a164

File tree

17 files changed

+43
-43
lines changed

17 files changed

+43
-43
lines changed

db_update.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,14 @@ def processEveTypes():
141141
(row['typeName_en-us'].startswith('Civilian') and "Shuttle" not in row['typeName_en-us'])
142142
or row['typeName_en-us'] == 'Capsule'
143143
or row['groupID'] == 4033 # destructible effect beacons
144-
or re.match('AIR .+Booster.*', row['typeName_en-us'])
144+
or re.match(r'AIR .+Booster.*', row['typeName_en-us'])
145145
):
146146
row['published'] = True
147147
# Nearly useless and clutter search results too much
148148
elif (
149149
row['typeName_en-us'].startswith('Limited Synth ')
150150
or row['typeName_en-us'].startswith('Expired ')
151-
or re.match('Mining Blitz .+ Booster Dose .+', row['typeName_en-us'])
151+
or re.match(r'Mining Blitz .+ Booster Dose .+', row['typeName_en-us'])
152152
or row['typeName_en-us'].endswith(' Filament') and (
153153
"'Needlejack'" not in row['typeName_en-us'] and
154154
"'Devana'" not in row['typeName_en-us'] and
@@ -544,7 +544,7 @@ def processImplantSets(eveTypesData):
544544
continue
545545
typeName = row.get('typeName_en-us', '')
546546
# Regular sets matching
547-
m = re.match('(?P<grade>(High|Mid|Low)-grade) (?P<set>\w+) (?P<implant>(Alpha|Beta|Gamma|Delta|Epsilon|Omega))', typeName, re.IGNORECASE)
547+
m = re.match(r'(?P<grade>(High|Mid|Low)-grade) (?P<set>\w+) (?P<implant>(Alpha|Beta|Gamma|Delta|Epsilon|Omega))', typeName, re.IGNORECASE)
548548
if m:
549549
implantSets.setdefault((m.group('grade'), m.group('set')), set()).add(row['typeID'])
550550
# Special set matching

dist_assets/win/dist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
os.environ["PYFA_DIST_DIR"] = os.path.join(os.getcwd(), 'dist')
1515

1616
os.environ["PYFA_VERSION"] = version
17-
iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
17+
iscc = r"C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
1818

1919
source = os.path.join(os.environ["PYFA_DIST_DIR"], "pyfa")
2020

eos/db/migrations/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# loop through python files, extracting update number and function, and
2222
# adding it to a list
2323
modname_tail = modName.rsplit('.', 1)[-1]
24-
m = re.match("^upgrade(?P<index>\d+)$", modname_tail)
24+
m = re.match(r"^upgrade(?P<index>\d+)$", modname_tail)
2525
if not m:
2626
continue
2727
index = int(m.group("index"))

eos/gamedata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def shortName(self):
573573
for kw in keywords:
574574
if name.startswith(f'{kw} '):
575575
name = kw
576-
m = re.match('(?P<mutagrade>\S+) (?P<dronetype>\S+) Drone (?P<mutatype>\S+) Mutaplasmid', name)
576+
m = re.match(r'(?P<mutagrade>\S+) (?P<dronetype>\S+) Drone (?P<mutatype>\S+) Mutaplasmid', name)
577577
if m:
578578
name = '{} {}'.format(m.group('mutagrade'), m.group('mutatype'))
579579
return name

graphs/gui/canvasPanel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ def addYMark(val):
273273
legendLines = []
274274
for i, iData in enumerate(legendData):
275275
color, lineStyle, label = iData
276-
legendLines.append(Line2D([0], [0], color=color, linestyle=lineStyle, label=label.replace('$', '\$')))
276+
legendLines.append(Line2D([0], [0], color=color, linestyle=lineStyle, label=label.replace('$', r'\$')))
277277

278278
if len(legendLines) > 0 and self.graphFrame.ctrlPanel.showLegend:
279279
legend = self.subplot.legend(handles=legendLines)

gui/builtinItemStatsViews/itemDescription.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def __init__(self, parent, stuff, item):
2222

2323
desc = item.description.replace("\n", "<br>")
2424
# Strip font tags
25-
desc = re.sub("<( *)font( *)color( *)=(.*?)>(?P<inside>.*?)<( *)/( *)font( *)>", "\g<inside>", desc)
25+
desc = re.sub("<( *)font( *)color( *)=(.*?)>(?P<inside>.*?)<( *)/( *)font( *)>", r"\g<inside>", desc)
2626
# Strip URLs
27-
desc = re.sub("<( *)a(.*?)>(?P<inside>.*?)<( *)/( *)a( *)>", "\g<inside>", desc)
27+
desc = re.sub("<( *)a(.*?)>(?P<inside>.*?)<( *)/( *)a( *)>", r"\g<inside>", desc)
2828
desc = "<body bgcolor='{}' text='{}'>{}</body>".format(
2929
bgcolor.GetAsString(wx.C2S_HTML_SYNTAX),
3030
fgcolor.GetAsString(wx.C2S_HTML_SYNTAX),

gui/builtinViews/implantEditor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414

1515
def stripHtml(text):
16-
text = re.sub('<\s*br\s*/?\s*>', '\n', text)
17-
text = re.sub('</?[^/]+?(/\s*)?>', '', text)
16+
text = re.sub(r'<\s*br\s*/?\s*>', '\n', text)
17+
text = re.sub(r'</?[^/]+?(/\s*)?>', '', text)
1818
return text
1919

2020

gui/characterEditor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def DoRename(self, entity, name):
115115
sChar = Character.getInstance()
116116

117117
if entity.alphaCloneID:
118-
trimmed_name = re.sub('[ \(\u03B1\)]+$', '', name)
118+
trimmed_name = re.sub('[ \\(\u03B1\\)]+$', '', name)
119119
sChar.rename(entity, trimmed_name)
120120
else:
121121
sChar.rename(entity, name)

gui/updateDialog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ def __init__(self, parent, release, version):
6666
self.browser.Bind(wx.html2.EVT_WEBVIEW_NEWWINDOW, self.OnNewWindow)
6767

6868
link_patterns = [
69-
(re.compile("#(\d+)", re.I), r"https://github.com/pyfa-org/Pyfa/issues/\1"),
70-
(re.compile("@(\w+)", re.I), r"https://github.com/\1")
69+
(re.compile(r"#(\d+)", re.I), r"https://github.com/pyfa-org/Pyfa/issues/\1"),
70+
(re.compile(r"@(\w+)", re.I), r"https://github.com/\1")
7171
]
7272

7373
markdowner = markdown2.Markdown(

gui/utils/inputs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def OnText(self, event):
9696
if currentValue == self._storedValue:
9797
event.Skip()
9898
return
99-
if currentValue == '' or re.match('^\d*\.?\d*$', currentValue):
99+
if currentValue == '' or re.match(r'^\d*\.?\d*$', currentValue):
100100
self._storedValue = currentValue
101101
self.updateColor()
102102
event.Skip()
@@ -131,7 +131,7 @@ def OnText(self, event):
131131
if currentValue == self._storedValue:
132132
event.Skip()
133133
return
134-
if currentValue == '' or re.match('^\d*\.?\d*-?\d*\.?\d*$', currentValue):
134+
if currentValue == '' or re.match(r'^\d*\.?\d*-?\d*\.?\d*$', currentValue):
135135
self._storedValue = currentValue
136136
event.Skip()
137137
else:

0 commit comments

Comments
 (0)