Skip to content

Commit ca40d74

Browse files
committed
Run make lint-fix-unsafe
1 parent 944766b commit ca40d74

9 files changed

+13
-44
lines changed

cfbot_cirrus.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import cfbot_util
44

55
import requests
6-
import sys
76

87

98
def query_cirrus(query, variables):
@@ -91,7 +90,6 @@ def get_tasks_for_build(build_id):
9190

9291

9392
def get_task_results(commit):
94-
result = {}
9593
builds = get_builds_for_commit(
9694
cfbot_config.CIRRUS_USER, cfbot_config.CIRRUS_REPO, commit
9795
)
@@ -102,8 +100,6 @@ def get_task_results(commit):
102100

103101

104102
def pull_build_results(conn):
105-
builds = None
106-
task_results_for_commit = {}
107103
cursor = conn.cursor()
108104
cursor.execute("""SELECT commitfest_id,
109105
submission_id,
@@ -114,7 +110,6 @@ def pull_build_results(conn):
114110
keep_polling_branch = False
115111
tasks = get_task_results(commit_id)
116112
if len(tasks) == 0:
117-
keep_polling = True
118113
continue
119114
position = 0
120115
for task in get_task_results(commit_id):
@@ -155,9 +150,7 @@ def pull_build_results(conn):
155150
# artifacts (without bodies) and task commands (steps)
156151
if not task_still_running:
157152
# fetch the list of artifacts immediately
158-
have_artifacts = False
159153
for name, path, size in get_artifacts_for_task(task_id):
160-
have_artifacts = True
161154
cursor.execute(
162155
"""INSERT INTO artifact (task_id, name, path, size)
163156
VALUES (%s, %s, %s, %s)

cfbot_commitfest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def pull_modified_threads(conn):
8686
url = cfbot_commitfest_rpc.get_thread_url_for_submission(
8787
commitfest_id, submission_id
8888
)
89-
if url == None:
89+
if url is None:
9090
message_id = None
9191
else:
9292
message_id, attachments = (

cfbot_commitfest_rpc.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,10 @@
44
# For now these use webscraping, but they could become real API calls.
55

66
import cfbot_util
7-
import datetime
8-
import errno
97
import html
108

119
# from html.parser import HTMLParser
12-
import os
1310
import re
14-
import requests
15-
import subprocess
16-
import shutil
17-
import sys
18-
import tarfile
19-
import time
20-
import unicodedata
21-
from urllib.parse import urlparse
2211

2312

2413
class Submission:
@@ -66,7 +55,7 @@ def get_latest_patches_from_thread_url(thread_url):
6655
# if there is a tarball attachment, there must be only one attachment,
6756
# otherwise give up on this thread (we don't know how to combine patches and
6857
# tarballs)
69-
if selected_message_attachments != None:
58+
if selected_message_attachments is not None:
7059
if any(
7160
x.endswith(".tgz") or x.endswith(".tar.gz") or x.endswith(".tar.bz2")
7261
for x in selected_message_attachments
@@ -177,9 +166,9 @@ def get_current_commitfest_id():
177166
)
178167
if groups:
179168
commitfest_id = groups.group(1)
180-
state = groups.group(2)
169+
groups.group(2)
181170
result = int(commitfest_id)
182-
if result == None:
171+
if result is None:
183172
raise Exception("Could not determine the current Commitfest ID")
184173
return result
185174

cfbot_patch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import re
2121
import requests
2222
import shlex
23-
import shutil
2423
import subprocess
2524
import tempfile
2625
import time

cfbot_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
def get_http_session():
1010
"""A session allowing for HTTP connection reuse."""
1111
global global_http_session
12-
if global_http_session == None:
12+
if global_http_session is None:
1313
global_http_session = requests.Session()
1414
return global_http_session
1515

cfbot_web.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python3
22

3-
import cfbot_commitfest_rpc
43
import cfbot_config
54
import cfbot_util
65
import math
@@ -299,7 +298,7 @@ def build_page(
299298
expected_runtimes = load_expected_runtimes(conn)
300299
last_status = None
301300
commitfest_id_for_link = commitfest_id
302-
if commitfest_id_for_link == None:
301+
if commitfest_id_for_link is None:
303302
commitfest_id_for_link = ""
304303
with open(path + ".tmp", "w") as f:
305304
f.write(
@@ -361,16 +360,18 @@ def build_page(
361360
)
362361
for submission in submissions:
363362
# skip if we need to filter by commitfest
364-
if commitfest_id != None and submission.commitfest_id != commitfest_id:
363+
if commitfest_id is not None and submission.commitfest_id != commitfest_id:
365364
continue
366365

367366
# skip if we need to filter by author
368-
if filter_author != None and filter_author not in all_authors(submission):
367+
if filter_author is not None and filter_author not in all_authors(
368+
submission
369+
):
369370
continue
370371

371372
# create a new heading row if this is a new CF status
372373
status = submission.status
373-
if last_status == None or last_status != status:
374+
if last_status is None or last_status != status:
374375
f.write(
375376
""" <tr><td colspan="5"><h2>%s</h2></td></tr>\n"""
376377
% html_escape(status)

cfbot_web_highlights.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
#!/usr/bin/env python3
22

3-
import cfbot_commitfest_rpc
43
import cfbot_config
54
import cfbot_util
65
import cfbot_web
76
import html
8-
import math
97
import os
10-
import re
11-
import unicodedata
128

139
MODES = (
1410
"all",

cfbot_web_statistics.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
#!/usr/bin/env python3
22

3-
import cfbot_commitfest_rpc
43
import cfbot_config
54
import cfbot_util
6-
import math
75
import os
8-
import re
9-
import unicodedata
10-
11-
from cfbot_commitfest_rpc import Submission
126

137

148
def header(f):
@@ -98,7 +92,7 @@ def per_day(f, conn):
9892
task = ""
9993
else:
10094
last_task = task
101-
if stddev == None:
95+
if stddev is None:
10296
stddev = 0
10397
f.write(
10498
"""

cfbot_work_queue.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#!/usr/bin/env python3
22

33
import cfbot_commitfest
4-
import cfbot_commitfest_rpc
54
import cfbot_config
65
import cfbot_util
76
import cfbot_web_highlights
8-
import math
9-
import os
107
import re
118
import scipy.stats
129
import requests
@@ -341,7 +338,7 @@ def fetch_task_logs(conn, task_id):
341338
"https://api.cirrus-ci.com/v1/task/%s/logs/%s.log" % (task_id, command),
342339
True,
343340
)
344-
if log_bin == None:
341+
if log_bin is None:
345342
continue
346343
log = binary_to_safe_utf8(log_bin)
347344
cursor.execute(

0 commit comments

Comments
 (0)