Skip to content

Commit 5f7af1f

Browse files
committed
fix: Flake8 fixes, merge conflicts
1 parent be53047 commit 5f7af1f

File tree

3 files changed

+13
-34
lines changed

3 files changed

+13
-34
lines changed

autowebcompat/crawler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from selenium.common.exceptions import NoAlertPresentException, NoSuchWindowException
1+
from selenium.common.exceptions import NoAlertPresentException
2+
from selenium.common.exceptions import NoSuchWindowException
23

34

45
def close_all_windows_except_first(driver):

autowebcompat/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
import sys
88
import threading
99

10+
from PIL import Image
1011
import keras
1112
from keras.preprocessing.image import ImageDataGenerator
1213
from keras.preprocessing.image import img_to_array
1314
from keras.preprocessing.image import load_img
14-
from tensorflow.python.client import device_lib
15-
from PIL import Image
1615
import numpy as np
16+
from tensorflow.python.client import device_lib
1717

1818

1919
def get_bugs():

collect.py

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -64,37 +64,6 @@ def wait_loaded(driver):
6464
print('Continuing...')
6565

6666

67-
def get_all_attributes(driver, child):
68-
child_attributes = driver.execute_script("""
69-
let elem_attribute = {};
70-
71-
for (let i = 0; i < arguments[0].attributes.length; i++) {
72-
elem_attribute[arguments[0].attributes[i].name] = arguments[0].attributes[i].value;
73-
}
74-
return elem_attribute;
75-
""", child)
76-
77-
return child_attributes
78-
79-
80-
def get_elements_with_attributes(driver, elem_attributes, children):
81-
elems_with_same_attributes = []
82-
for child in children:
83-
child_attributes = get_all_attributes(driver, child)
84-
if child_attributes == elem_attributes:
85-
elems_with_same_attributes.append(child)
86-
return elems_with_same_attributes
87-
88-
89-
def get_elements_with_properties(driver, elem_properties, children):
90-
elems_with_same_properties = []
91-
for child in children:
92-
child_properties = get_element_properties(driver, child)
93-
if child_properties == elem_properties:
94-
elems_with_same_properties.append(child)
95-
return elems_with_same_properties
96-
97-
9867
def get_element_properties(driver, child):
9968
child_properties = driver.execute_script("""
10069
let elem_properties = {
@@ -111,6 +80,15 @@ def get_element_properties(driver, child):
11180
return child_properties
11281

11382

83+
def get_elements_with_properties(driver, elem_properties, children):
84+
elems_with_same_properties = []
85+
for child in children:
86+
child_properties = get_element_properties(driver, child)
87+
if child_properties == elem_properties:
88+
elems_with_same_properties.append(child)
89+
return elems_with_same_properties
90+
91+
11492
def was_visited(current_path, visited_paths, elem_properties):
11593
current_path_elements = [element for element, _, _ in current_path]
11694
current_path_elements.append(elem_properties)

0 commit comments

Comments
 (0)