Applying black formatting
- Fixing flake8 configuration to agree with black - Adding black validation check to github actions
This commit is contained in:
@@ -3,13 +3,15 @@
|
||||
from common import rand_int, rand_double, rand_bool, WORDS, from_bytes_helper
|
||||
from random import choice
|
||||
from string import ascii_letters
|
||||
|
||||
try:
|
||||
# Python 2
|
||||
from itertools import izip
|
||||
# Python 2
|
||||
from itertools import izip
|
||||
except ImportError:
|
||||
izip = zip
|
||||
izip = zip
|
||||
import catrank_pb2
|
||||
|
||||
|
||||
class Benchmark:
|
||||
def __init__(self, compression):
|
||||
self.Request = catrank_pb2.SearchResultList
|
||||
@@ -26,7 +28,9 @@ class Benchmark:
|
||||
result = request.result.add()
|
||||
result.score = 1000 - i
|
||||
url_size = rand_int(100)
|
||||
result.url = "http://example.com/" + ''.join([choice(ascii_letters) for _ in range(url_size)])
|
||||
result.url = "http://example.com/" + "".join(
|
||||
[choice(ascii_letters) for _ in range(url_size)]
|
||||
)
|
||||
|
||||
isCat = rand_bool()
|
||||
isDog = rand_bool()
|
||||
@@ -42,7 +46,7 @@ class Benchmark:
|
||||
|
||||
snippet += [choice(WORDS) for i in range(rand_int(20))]
|
||||
|
||||
result.snippet = ''.join(snippet)
|
||||
result.snippet = "".join(snippet)
|
||||
|
||||
return goodCount
|
||||
|
||||
@@ -60,10 +64,9 @@ class Benchmark:
|
||||
resp.url = req.url
|
||||
resp.snippet = req.snippet
|
||||
|
||||
|
||||
def check(self, response, expected):
|
||||
goodCount = 0
|
||||
|
||||
|
||||
for result in response.result:
|
||||
if result.score > 1001:
|
||||
goodCount += 1
|
||||
|
||||
Reference in New Issue
Block a user