mirror of
https://github.com/neuml/txtai.git
synced 2026-10-12 02:19:52 +00:00
Upgrade pylint and black, closes #797
This commit is contained in:
@@ -47,7 +47,7 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
pip install -U wheel
|
||||
pip install .[all,dev]
|
||||
pip install .[all,dev] fasttext==0.9.2
|
||||
python -c "import nltk; nltk.download(['punkt', 'punkt_tab', 'averaged_perceptron_tagger_eng'])"
|
||||
python --version
|
||||
make data coverage
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
repos:
|
||||
- repo: https://github.com/pycqa/pylint
|
||||
rev: v2.16.2
|
||||
rev: v3.3.1
|
||||
hooks:
|
||||
- id: pylint
|
||||
args:
|
||||
- -d import-error
|
||||
- -d duplicate-code
|
||||
- -d too-many-positional-arguments
|
||||
- repo: https://github.com/ambv/black
|
||||
rev: 23.1.0
|
||||
rev: 24.10.0
|
||||
hooks:
|
||||
- id: black
|
||||
language_version: python3
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
Index imports
|
||||
"""
|
||||
|
||||
|
||||
from .action import Action
|
||||
from .autoid import AutoId
|
||||
from .configuration import Configuration
|
||||
|
||||
@@ -127,13 +127,11 @@ class Models:
|
||||
return (
|
||||
deviceid
|
||||
if 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()
|
||||
)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
Pooling imports
|
||||
"""
|
||||
|
||||
|
||||
from .base import Pooling
|
||||
from .cls import ClsPooling
|
||||
from .factory import PoolingFactory
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user