Fix new flake8 errors
This is replcing checks of type(obj) == foo with isinstance. I think in all
cases we're also OK with subtypes being considered matching.
diff --git a/tools/webdriver/webdriver/bidi/error.py b/tools/webdriver/webdriver/bidi/error.py
index 8507a51..4a9b4ba 100644
--- a/tools/webdriver/webdriver/bidi/error.py
+++ b/tools/webdriver/webdriver/bidi/error.py
@@ -98,5 +98,5 @@
_errors: DefaultDict[str, Type[BidiException]] = collections.defaultdict()
for item in list(locals().values()):
- if type(item) == type and item != BidiException and issubclass(item, BidiException):
+ if isinstance(item, type) and item != BidiException and issubclass(item, BidiException):
_errors[item.error_code] = item
diff --git a/tools/webdriver/webdriver/error.py b/tools/webdriver/webdriver/error.py
index 7d5d914..25e4b39 100644
--- a/tools/webdriver/webdriver/error.py
+++ b/tools/webdriver/webdriver/error.py
@@ -228,5 +228,5 @@
_errors: DefaultDict[str, Type[WebDriverException]] = collections.defaultdict()
for item in list(locals().values()):
- if type(item) == type and item != WebDriverException and issubclass(item, WebDriverException):
+ if isinstance(item, type) and item != WebDriverException and issubclass(item, WebDriverException):
_errors[item.status_code] = item
diff --git a/tools/wptrunner/wptrunner/executors/base.py b/tools/wptrunner/wptrunner/executors/base.py
index 9159158..b148365 100644
--- a/tools/wptrunner/wptrunner/executors/base.py
+++ b/tools/wptrunner/wptrunner/executors/base.py
@@ -104,7 +104,7 @@
if not log_data:
return
for item in log_data:
- if type(item) != dict:
+ if not isinstance(item, dict):
# Skip relation strings.
continue
if "hash" not in item:
diff --git a/tools/wptrunner/wptrunner/formatters/wptreport.py b/tools/wptrunner/wptrunner/formatters/wptreport.py
index be6cca2..21c1211 100644
--- a/tools/wptrunner/wptrunner/formatters/wptreport.py
+++ b/tools/wptrunner/wptrunner/formatters/wptreport.py
@@ -91,7 +91,7 @@
test["screenshots"] = {
strip_server(item["url"]): "sha1:" + item["hash"]
for item in data["extra"]["reftest_screenshots"]
- if type(item) == dict
+ if isinstance(item, dict)
}
test_name = data["test"]
result = {"test": data["test"]}
diff --git a/tools/wptrunner/wptrunner/formatters/wptscreenshot.py b/tools/wptrunner/wptrunner/formatters/wptscreenshot.py
index 2b2d1ad..9895597 100644
--- a/tools/wptrunner/wptrunner/formatters/wptscreenshot.py
+++ b/tools/wptrunner/wptrunner/formatters/wptscreenshot.py
@@ -38,7 +38,7 @@
return
output = ""
for item in data["extra"]["reftest_screenshots"]:
- if type(item) != dict:
+ if not isinstance(item, dict):
# Skip the relation string.
continue
checksum = "sha1:" + item["hash"]