зеркало из https://github.com/openwpm/OpenWPM.git
Fix flake8 issues
This commit is contained in:
Родитель
fbe1037f0d
Коммит
71fa3ee936
|
@ -79,7 +79,7 @@ def ExtractXPath(element, use_id=True):
|
|||
# Starting node
|
||||
# Check id first
|
||||
if use_id and element.get('id') is not None:
|
||||
return '//*/' + element.name + '[@id=\"' + element.get('id') + '\"]'
|
||||
return '//*/' + element.name + '[@id="' + element.get('id') + '"]'
|
||||
|
||||
xpath = check_previous_tags(element)
|
||||
|
||||
|
@ -91,7 +91,7 @@ def ExtractXPath(element, use_id=True):
|
|||
|
||||
# Check id first
|
||||
if use_id and parent.get('id') is not None:
|
||||
return '//*/' + parent.name + '[@id=\"' + parent.get('id') + '\"]/' + xpath # noqa
|
||||
return '//*/' + parent.name + '[@id="' + parent.get('id') + '"]/' + xpath # noqa
|
||||
|
||||
xpath = check_previous_tags(parent) + '/' + xpath
|
||||
|
||||
|
@ -130,11 +130,11 @@ def xp1_wildcard(attr, string, normalize=True):
|
|||
pt2 = ''
|
||||
|
||||
if parts[0] != '':
|
||||
pt1 = 'starts-with(' + attr + ', \'' + parts[0] + '\')'
|
||||
pt1 = 'starts-with(' + attr + ", '" + parts[0] + "')"
|
||||
if parts[1] != '':
|
||||
pt2 = ('contains(substring(' + attr +
|
||||
', string-length(' + attr + ')-' + str(len(parts[1]) - 1) +
|
||||
'), \'' + parts[1] + '\')')
|
||||
pt2 = 'contains(substring(' + attr + \
|
||||
', string-length(' + attr + ')-' + \
|
||||
str(len(parts[1]) - 1) + "), '" + parts[1] + "')"
|
||||
|
||||
if pt1 == '' and pt2 != '':
|
||||
return '[' + pt2 + ']'
|
||||
|
|
|
@ -203,11 +203,11 @@ class TaskManager:
|
|||
if browser.display_pid is not None:
|
||||
display_pids.add(browser.display_pid)
|
||||
for process in psutil.process_iter():
|
||||
if (process.create_time() + 300 < check_time and (
|
||||
(process.name() == 'firefox' and
|
||||
process.pid not in browser_pids) or
|
||||
(process.name() == 'Xvfb' and
|
||||
process.pid not in display_pids))):
|
||||
if process.create_time() + 300 < check_time and (
|
||||
(process.name() == 'firefox' and (
|
||||
process.pid not in browser_pids)) or (
|
||||
process.name() == 'Xvfb' and (
|
||||
process.pid not in display_pids))):
|
||||
self.logger.debug("Process: %s (pid: %i) with start "
|
||||
"time %s found running but not in "
|
||||
"browser process list. Killing." % (
|
||||
|
|
|
@ -48,11 +48,10 @@ def get_firefox_binary_path():
|
|||
root_dir = os.path.dirname(__file__) + "/../.."
|
||||
if platform == 'darwin':
|
||||
firefox_binary_path = os.path.abspath(
|
||||
root_dir +
|
||||
"/Nightly.app/Contents/MacOS/firefox-bin")
|
||||
root_dir + "/Nightly.app/Contents/MacOS/firefox-bin")
|
||||
else:
|
||||
firefox_binary_path = os.path.abspath(root_dir +
|
||||
"/firefox-bin/firefox-bin")
|
||||
firefox_binary_path = os.path.abspath(
|
||||
root_dir + "/firefox-bin/firefox-bin")
|
||||
|
||||
if not os.path.isfile(firefox_binary_path):
|
||||
raise RuntimeError(
|
||||
|
@ -69,8 +68,8 @@ def get_geckodriver_exec_path():
|
|||
we throw a RuntimeError.
|
||||
"""
|
||||
firefox_binary_path = get_firefox_binary_path()
|
||||
geckodriver_executable_path = (os.path.dirname(firefox_binary_path)
|
||||
+ "/geckodriver")
|
||||
geckodriver_executable_path = (
|
||||
os.path.dirname(firefox_binary_path) + "/geckodriver")
|
||||
|
||||
if not os.path.isfile(geckodriver_executable_path):
|
||||
raise RuntimeError(
|
||||
|
|
|
@ -241,8 +241,8 @@ class TestExtension(OpenWPMTest):
|
|||
rows = db_utils.get_javascript_entries(db)
|
||||
observed_rows = set()
|
||||
for row in rows:
|
||||
if (row['symbol'] == "RTCPeerConnection.setLocalDescription" and
|
||||
row['operation'] == 'call'):
|
||||
if (row['symbol'] == "RTCPeerConnection.setLocalDescription" and (
|
||||
row['operation'] == 'call')):
|
||||
sdp_offer = row['arguments']
|
||||
self.check_webrtc_sdp_offer(sdp_offer)
|
||||
else:
|
||||
|
|
Загрузка…
Ссылка в новой задаче