Skip to content

Commit c522eef

Browse files
committed
Fix some flake8 warnings
1 parent 62b6e06 commit c522eef

File tree

4 files changed

+6
-15
lines changed

4 files changed

+6
-15
lines changed

server/fishtest/rundb.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import configparser
22
import copy
3-
import gzip
43
import io
54
import math
65
import os
@@ -12,7 +11,6 @@
1211
import textwrap
1312
import threading
1413
import time
15-
import zlib
1614
from datetime import datetime, timedelta, timezone
1715

1816
import fishtest.stats.stat_util
@@ -185,7 +183,7 @@ def new_run(
185183
if spsa is not None:
186184
run_args["spsa"] = spsa
187185

188-
tc_base = re.search("^(\d+(\.\d+)?)", tc)
186+
tc_base = re.search(r"^(\d+(\.\d+)?)", tc)
189187
if tc_base:
190188
tc_base = float(tc_base.group(1))
191189
new_run = {

server/fishtest/util.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -503,8 +503,8 @@ def validate(schema, object, name, strict=False):
503503
return f"{name} is not of type {schema.__name__}"
504504
else:
505505
return ""
506-
elif isinstance(schema, list) or isinstance(schema, tuple):
507-
if type(schema) != type(object):
506+
elif isinstance(schema, (list, tuple)):
507+
if not isinstance(schema, type(object)):
508508
return f"{name} is not of type {type(schema).__name}"
509509
l = len(object)
510510
if strict and l != len(schema):
@@ -519,7 +519,7 @@ def validate(schema, object, name, strict=False):
519519
return ret
520520
return ""
521521
elif isinstance(schema, dict):
522-
if type(schema) != type(object):
522+
if not isinstance(schema, type(object)):
523523
return f"{name} is not of type {type(schema).__name}"
524524
if strict:
525525
_k = _keys(schema)

server/fishtest/views.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import html
44
import os
55
import re
6-
import textwrap
76
import threading
87
import time
98
from datetime import datetime, timezone
@@ -21,12 +20,7 @@
2120
password_strength,
2221
update_residuals,
2322
)
24-
from pyramid.httpexceptions import (
25-
HTTPBadRequest,
26-
HTTPFound,
27-
HTTPUnauthorized,
28-
exception_response,
29-
)
23+
from pyramid.httpexceptions import HTTPFound, exception_response
3024
from pyramid.security import forget, remember
3125
from pyramid.view import forbidden_view_config, view_config
3226
from requests.exceptions import ConnectionError, HTTPError
@@ -203,7 +197,7 @@ def workers(request):
203197
ensure_logged_in(request)
204198
owner_name = worker_name.split("-")[0]
205199
if not is_approver and blocker_name != owner_name:
206-
request.session.flash(f"Only owners and approvers can block/unblock", "error")
200+
request.session.flash("Only owners and approvers can block/unblock", "error")
207201
return {
208202
"show_admin": False,
209203
"show_email": is_approver,

server/fishtest/workerdb.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from datetime import datetime, timezone
22

33
from fishtest.util import validate
4-
from pymongo import DESCENDING
54

65
schema = {
76
"worker_name": str,

0 commit comments

Comments
 (0)