💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Update pylint and black versions in pre-commit
davidmezzettie3ddc5e9de7b
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex aaa97115..163e6c41 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -1,13 +1,13 @@repos:- repo: https://github.com/pycqa/pylint- rev: v2.12.1+ rev: v2.16.2hooks:- id: pylintargs:- -d import-error- -d duplicate-code- repo: https://github.com/ambv/black- rev: 22.3.0+ rev: 23.1.0hooks:- id: blacklanguage_version: python3diff --git a/.pylintrc b/.pylintrcindex dcb45ddc..3bb9f57b 100644--- a/.pylintrc+++ b/.pylintrc@@ -15,6 +15,3 @@ min-public-methods=0[FORMAT]max-line-length=150--[MESSAGES CONTROL]-disable=R0201diff --git a/docker/aws/workflow.py b/docker/aws/workflow.pyindex e44e663b..f896ea32 100644--- a/docker/aws/workflow.py+++ b/docker/aws/workflow.py@@ -8,6 +8,7 @@ from txtai.api import APIAPP = None+# pylint: disable=W0603,W0613def handler(event, context):"""diff --git a/examples/workflows.py b/examples/workflows.pyindex 4eee1b8a..62278557 100644--- a/examples/workflows.py+++ b/examples/workflows.py@@ -586,7 +586,7 @@ class Application:tasks.append({"action": wtype})elif wtype == "service":- config = dict(**component)+ config = {**component}config["task"] = wtypetasks.append(config)diff --git a/src/python/txtai/console/base.py b/src/python/txtai/console/base.pyindex 4459f2f1..9d734a92 100644--- a/src/python/txtai/console/base.py+++ b/src/python/txtai/console/base.py@@ -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 = ""diff --git a/src/python/txtai/graph/base.py b/src/python/txtai/graph/base.pyindex 42f95011..4149efde 100644--- a/src/python/txtai/graph/base.py+++ b/src/python/txtai/graph/base.py@@ -14,6 +14,7 @@ from ..archive import ArchiveFactoryfrom .topics import Topics+# pylint: disable=R0904class Graph:"""diff --git a/src/python/txtai/models/onnx.py b/src/python/txtai/models/onnx.pyindex 5be90433..5c2ea0c9 100644--- a/src/python/txtai/models/onnx.py+++ b/src/python/txtai/models/onnx.py@@ -20,6 +20,7 @@ from transformers.modeling_utils import PreTrainedModelfrom .registry import Registry+# pylint: disable=W0223class OnnxModel(PreTrainedModel):"""diff --git a/src/python/txtai/pipeline/text/crossencoder.py b/src/python/txtai/pipeline/text/crossencoder.pyindex 09d4842e..5bb42568 100644--- a/src/python/txtai/pipeline/text/crossencoder.py+++ b/src/python/txtai/pipeline/text/crossencoder.py@@ -60,6 +60,7 @@ class CrossEncoder(HFPipeline):"""# Output functions+ # pylint: disable=C3001identity = lambda x: xsigmoid = lambda x: 1.0 / (1.0 + np.exp(-x))softmax = lambda x: np.exp(x) / np.sum(np.exp(x))diff --git a/test/python/testapi/testembeddings.py b/test/python/testapi/testembeddings.pyindex 108def91..65665515 100644--- a/test/python/testapi/testembeddings.py+++ b/test/python/testapi/testembeddings.py@@ -175,6 +175,7 @@ class TestEmbeddings(unittest.TestCase):questions = ["What team won the game?", "What was score?"]+ # pylint: disable=C3001execute = lambda query: self.client.post("extract",json={"queue": [{"name": question, "query": query, "question": question, "snippet": False} for question in questions], "texts": data},diff --git a/test/python/testapi/testworkflow.py b/test/python/testapi/testworkflow.pyindex b36b9800..83ed456d 100644--- a/test/python/testapi/testworkflow.py+++ b/test/python/testapi/testworkflow.py@@ -183,6 +183,8 @@ class TestWorkflow(unittest.TestCase):api = API({})api.pool = ThreadPool()++ # pylint: disable=C2801api.__del__()self.assertIsNone(api.pool)diff --git a/test/python/testcloud.py b/test/python/testcloud.pyindex 29d664f9..f30d8d22 100644--- a/test/python/testcloud.py+++ b/test/python/testcloud.py@@ -105,7 +105,7 @@ class TestCloud(unittest.TestCase):def filedownload(**kwargs):if "Invalid" in kwargs["repo_id"]:- raise Exception+ raise FileNotFoundErrorreturn 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=W0719with self.assertRaises(Exception):self.embeddings.load(index, invalid)diff --git a/test/python/testpipeline/testextractor.py b/test/python/testpipeline/testextractor.pyindex 36c9fb77..47cb20e6 100644--- a/test/python/testpipeline/testextractor.py+++ b/test/python/testpipeline/testextractor.py@@ -57,6 +57,7 @@ class TestExtractor(unittest.TestCase):questions = ["What team won the game?", "What was score?"]+ # pylint: disable=C3001execute = lambda query: self.extractor([(question, query, question, False) for question in questions], self.data)answers = execute("Red Sox - Blue Jays")