Skip to content

Commit 2a65d75

Browse files
committed
Ignore more rules and fix more issues
1 parent 29d29c7 commit 2a65d75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+327
-353
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v2
2929
- uses: actions/setup-python@v2
30+
with:
31+
python-version: '3.8'
32+
- run: pip install '.[devel]'
3033
- uses: pre-commit/[email protected]
3134
with:
3235
extra_args: --show-diff-on-failure

kibble/api/handler.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454

5555
class KibbleHTTPError(Exception):
5656
def __init__(self, code, message):
57+
super().__init__()
5758
self.code = code
5859
self.message = message
5960

@@ -75,7 +76,7 @@ def __call__(self, environ, start_response, session):
7576
# Read JSON client data if any
7677
try:
7778
request_size = int(environ.get("CONTENT_LENGTH", 0))
78-
except (ValueError):
79+
except ValueError:
7980
request_size = 0
8081
requestBody = environ["wsgi.input"].read(request_size)
8182
formdata = {}
@@ -123,7 +124,7 @@ def __call__(self, environ, start_response, session):
123124
) + "\n"
124125
return
125126

126-
except:
127+
except: # pylint: disable=bare-except
127128
err_type, err_value, tb = sys.exc_info()
128129
traceback_output = ["API traceback:"]
129130
traceback_output += traceback.format_tb(tb)
@@ -133,7 +134,7 @@ def __call__(self, environ, start_response, session):
133134
start_response(
134135
"500 Internal Server Error", [("Content-Type", "application/json")]
135136
)
136-
except:
137+
except: # pylint: disable=bare-except
137138
pass
138139
yield json.dumps({"code": "500", "reason": "\n".join(traceback_output)})
139140

@@ -142,7 +143,6 @@ def fourohfour(environ, start_response):
142143
"""A very simple 404 handler"""
143144
start_response("404 Not Found", [("Content-Type", "application/json")])
144145
yield json.dumps({"code": 404, "reason": "API endpoint not found"}, indent=4) + "\n"
145-
return
146146

147147

148148
def application(environ, start_response):
@@ -164,7 +164,7 @@ def application(environ, start_response):
164164
session.headers.append(bucket)
165165
try:
166166
start_response("200 Okay", session.headers)
167-
except:
167+
except: # pylint: disable=bare-except
168168
pass
169169
a += 1
170170
# WSGI prefers byte strings, so convert if regular py3 string

kibble/api/pages/bio/newtimers.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ def find_earlier(session, query, when, who, which, where, doctype, dOrg):
7575
if "aggs" in query:
7676
del query["aggs"]
7777

78-
rangeQuery = {"range": {which: {"from": 0, "to": time.time()}}}
78+
range_query = {"range": {which: {"from": 0, "to": time.time()}}}
7979

8080
query["query"]["bool"]["must"] = [
81-
rangeQuery,
81+
range_query,
8282
{"term": {"organisation": dOrg}},
8383
{"term": {where: who}},
8484
]
@@ -90,10 +90,7 @@ def find_earlier(session, query, when, who, which, where, doctype, dOrg):
9090
doc = res["hits"]["hits"][0]["_source"]
9191
if doc[which] >= when:
9292
return [doc[which], doc]
93-
else:
94-
return [-1, None]
95-
else:
96-
return [-1, None]
93+
return [-1, None]
9794

9895

9996
def run(API, environ, indata, session):

kibble/api/pages/ci/queue.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
This is the CI queue timeseries renderer for Kibble
6666
"""
6767

68-
import hashlib
6968
import json
7069
import time
7170

kibble/api/pages/ci/status.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
This is the CI queue status (blocked/stuck) timeseries renderer for Kibble
6666
"""
6767

68-
import hashlib
6968
import json
7069
import time
7170

kibble/api/pages/ci/top-buildcount.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"""
6767

6868
import json
69-
import re
7069
import time
7170

7271

kibble/api/pages/ci/top-buildtime.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"""
6767

6868
import json
69-
import re
7069
import time
7170

7271

kibble/api/pages/code/commits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
This is the TopN committers list renderer for Kibble
6666
"""
6767

68-
import hashlib
68+
6969
import json
7070
import time
7171

kibble/api/pages/code/evolution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
This is the TopN committers list renderer for Kibble
6666
"""
6767

68-
import hashlib
68+
6969
import json
7070
import time
7171

@@ -119,7 +119,7 @@ def run(API, environ, indata, session):
119119
)
120120
sid = res["_scroll_id"]
121121
scroll_size = res["hits"]["total"]
122-
if type(scroll_size) is dict:
122+
if isinstance(scroll_size, dict):
123123
scroll_size = scroll_size["value"] # ES >= 7.x
124124

125125
timeseries = []

kibble/api/pages/code/pony-timeseries.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767

6868
import datetime
6969
import json
70-
import re
7170
import time
7271

7372
import dateutil.relativedelta

0 commit comments

Comments
 (0)