Skip to content

Commit 5c62c98

Browse files
committed
remove comments
1 parent 6f60eab commit 5c62c98

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

seleniumbase/core/capabilities_parser.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ def _parse_ast(contents):
99
except SyntaxError:
1010
pass
1111
try:
12+
# remove all comments
13+
contents = re.sub(re.compile(r"/\*.*?\*/", re.DOTALL), "", contents)
14+
contents = re.sub(re.compile(r"#.*?\n"), "", contents)
15+
1216
# remove anything before dict declaration like: "caps = { ..."
13-
# and try again
1417
match = re.match(r"^([^{]+)", contents)
1518
if match:
1619
contents = contents.replace(match.group(1), "")
20+
21+
# and try again
1722
return ast.literal_eval(contents)
1823
except SyntaxError:
1924
pass

0 commit comments

Comments
 (0)