💡 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
Upgrade pylint and black, closes #797
davidmezzettic3b3fc99153b
diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlindex c7b9913f..24e61b88 100644--- a/.github/workflows/build.yml+++ b/.github/workflows/build.yml@@ -47,7 +47,7 @@ jobs:- name: Buildrun: |pip install -U wheel- pip install .[all,dev]+ pip install .[all,dev] fasttext==0.9.2python -c "import nltk; nltk.download(['punkt', 'punkt_tab', 'averaged_perceptron_tagger_eng'])"python --versionmake data coveragediff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 163e6c41..79f065d4 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -1,13 +1,14 @@repos:- repo: https://github.com/pycqa/pylint- rev: v2.16.2+ rev: v3.3.1hooks:- id: pylintargs:- -d import-error- -d duplicate-code+ - -d too-many-positional-arguments- repo: https://github.com/ambv/black- rev: 23.1.0+ rev: 24.10.0hooks:- id: blacklanguage_version: python3diff --git a/examples/baseball.py b/examples/baseball.pyindex 58f81cb3..80cd7207 100644--- a/examples/baseball.py+++ b/examples/baseball.py@@ -497,7 +497,7 @@ class Application:st.markdown("Find players with similar statistics.")- category = self.category("Batting", "searchcategory")+ stats, category = None, self.category("Batting", "searchcategory")with st.form("search"):if category == "Batting":stats, columns = self.batting, self.batting.columns[:-6]diff --git a/src/python/txtai/embeddings/index/__init__.py b/src/python/txtai/embeddings/index/__init__.pyindex 013d4191..5b3a1f18 100644--- a/src/python/txtai/embeddings/index/__init__.py+++ b/src/python/txtai/embeddings/index/__init__.py@@ -2,7 +2,6 @@Index imports"""-from .action import Actionfrom .autoid import AutoIdfrom .configuration import Configurationdiff --git a/src/python/txtai/models/models.py b/src/python/txtai/models/models.pyindex 3c42da36..ce0cc2a8 100644--- a/src/python/txtai/models/models.py+++ b/src/python/txtai/models/models.py@@ -127,13 +127,11 @@ class Models:return (deviceidif isinstance(deviceid, str)- else "cpu"- if deviceid < 0- else f"cuda:{deviceid}"- if torch.cuda.is_available()- else "mps"- if Models.hasmpsdevice()- else Models.finddevice()+ else (+ "cpu"+ if deviceid < 0+ else f"cuda:{deviceid}" if torch.cuda.is_available() else "mps" if Models.hasmpsdevice() else Models.finddevice()+ ))@staticmethoddiff --git a/src/python/txtai/models/pooling/__init__.py b/src/python/txtai/models/pooling/__init__.pyindex 41aa71a5..f5a8defe 100644--- a/src/python/txtai/models/pooling/__init__.py+++ b/src/python/txtai/models/pooling/__init__.py@@ -2,7 +2,6 @@Pooling imports"""-from .base import Poolingfrom .cls import ClsPoolingfrom .factory import PoolingFactorydiff --git a/src/python/txtai/scoring/pgtext.py b/src/python/txtai/scoring/pgtext.pyindex e3bea03b..4646f05d 100644--- a/src/python/txtai/scoring/pgtext.py+++ b/src/python/txtai/scoring/pgtext.py@@ -127,9 +127,11 @@ class PGText(Scoring):MetaData(),Column("indexid", Integer, primary_key=True, autoincrement=False),Column("text", Text),- Column("vector", TSVECTOR, Computed(f"to_tsvector('{self.language}', text)", persisted=True))- if self.engine.dialect.name == "postgresql"- else Column("vector", Integer),+ (+ Column("vector", TSVECTOR, Computed(f"to_tsvector('{self.language}', text)", persisted=True))+ if self.engine.dialect.name == "postgresql"+ else Column("vector", Integer)+ ),)# Create ANN index - inner product is equal to cosine similarity on normalized vectors