Update pylint and black versions in pre-commit

This commit is contained in:
davidmezzetti
2023-02-19 14:28:07 -05:00
parent 9899ba0a56
commit e3ddc5e9de
12 changed files with 14 additions and 8 deletions
+2 -2
View File
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/pycqa/pylint
rev: v2.12.1
rev: v2.16.2
hooks:
- id: pylint
args:
- -d import-error
- -d duplicate-code
- repo: https://github.com/ambv/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
language_version: python3
-3
View File
@@ -15,6 +15,3 @@ min-public-methods=0
[FORMAT]
max-line-length=150
[MESSAGES CONTROL]
disable=R0201
+1
View File
@@ -8,6 +8,7 @@ from txtai.api import API
APP = None
# pylint: disable=W0603,W0613
def handler(event, context):
"""
+1 -1
View File
@@ -586,7 +586,7 @@ class Application:
tasks.append({"action": wtype})
elif wtype == "service":
config = dict(**component)
config = {**component}
config["task"] = wtype
tasks.append(config)
+1 -1
View File
@@ -249,7 +249,7 @@ class Console(Cmd):
spans.append((token, score, color))
if result["score"] >= 0.05 and not [color for _, _, color in spans if color]:
mscore = max([score for _, score, _ in spans])
mscore = max(score for _, score, _ in spans)
spans = [(token, score, f"b {self.vhighlight}" if score == mscore else color) for token, score, color in spans]
output = ""
+1
View File
@@ -14,6 +14,7 @@ from ..archive import ArchiveFactory
from .topics import Topics
# pylint: disable=R0904
class Graph:
"""
+1
View File
@@ -20,6 +20,7 @@ from transformers.modeling_utils import PreTrainedModel
from .registry import Registry
# pylint: disable=W0223
class OnnxModel(PreTrainedModel):
"""
@@ -60,6 +60,7 @@ class CrossEncoder(HFPipeline):
"""
# Output functions
# pylint: disable=C3001
identity = lambda x: x
sigmoid = lambda x: 1.0 / (1.0 + np.exp(-x))
softmax = lambda x: np.exp(x) / np.sum(np.exp(x))
+1
View File
@@ -175,6 +175,7 @@ class TestEmbeddings(unittest.TestCase):
questions = ["What team won the game?", "What was score?"]
# pylint: disable=C3001
execute = lambda query: self.client.post(
"extract",
json={"queue": [{"name": question, "query": query, "question": question, "snippet": False} for question in questions], "texts": data},
+2
View File
@@ -183,6 +183,8 @@ class TestWorkflow(unittest.TestCase):
api = API({})
api.pool = ThreadPool()
# pylint: disable=C2801
api.__del__()
self.assertIsNone(api.pool)
+2 -1
View File
@@ -105,7 +105,7 @@ class TestCloud(unittest.TestCase):
def filedownload(**kwargs):
if "Invalid" in kwargs["repo_id"]:
raise Exception
raise FileNotFoundError
return index
@@ -143,6 +143,7 @@ class TestCloud(unittest.TestCase):
self.assertFalse(self.embeddings.exists(index, invalid))
# Test exception raised when trying to load index and doesn't exist in cloud storage
# pylint: disable=W0719
with self.assertRaises(Exception):
self.embeddings.load(index, invalid)
@@ -57,6 +57,7 @@ class TestExtractor(unittest.TestCase):
questions = ["What team won the game?", "What was score?"]
# pylint: disable=C3001
execute = lambda query: self.extractor([(question, query, question, False) for question in questions], self.data)
answers = execute("Red Sox - Blue Jays")