Skip to content

Commit 2329321

Browse files
committed
Fixed Python 2.7.3 backwards compatible regexes (#325)
1 parent f19c225 commit 2329321

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mbed/mbed.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ def geturl():
449449
lines = f.read().splitlines()
450450
if tagpaths in lines:
451451
idx = lines.index(tagpaths)
452-
m = re.match(r'^([\w_]+)\s*=\s*(.*)?$', lines[idx+1])
452+
m = re.match(r'^([\w_]+)\s*=\s*(.*)$', lines[idx+1])
453453
if m:
454454
if m.group(1) == 'default':
455455
default_url = m.group(2)
@@ -1366,7 +1366,7 @@ def set(self, var, val):
13661366
lines = []
13671367

13681368
for line in lines:
1369-
m = re.match(r'^([\w+-]+)\=(.*)?$', line)
1369+
m = re.match(r'^([\w+-]+)\=(.*)$', line)
13701370
if m and m.group(1) == var:
13711371
lines.remove(line)
13721372

@@ -1390,7 +1390,7 @@ def get(self, var, default_val=None):
13901390
lines = []
13911391

13921392
for line in lines:
1393-
m = re.match(r'^([\w+-]+)\=(.*)?$', line)
1393+
m = re.match(r'^([\w+-]+)\=(.*)$', line)
13941394
if m and m.group(1) == var:
13951395
return m.group(2)
13961396
return default_val
@@ -1406,7 +1406,7 @@ def list(self):
14061406

14071407
vars = {}
14081408
for line in lines:
1409-
m = re.match(r'^([\w+-]+)\=(.*)?$', line)
1409+
m = re.match(r'^([\w+-]+)\=(.*)$', line)
14101410
if m and m.group(1) and m.group(1) != 'ROOT':
14111411
vars[m.group(1)] = m.group(2)
14121412
return vars

0 commit comments

Comments
 (0)