Skip to content

Commit

Permalink
Upgrade to ruff v0.0.290
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed Sep 16, 2023
1 parent c884e25 commit 40f3efd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ repos:
- id: black-jupyter

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.289
rev: v0.0.290
hooks:
- id: ruff

Expand Down
2 changes: 1 addition & 1 deletion haystack/nodes/other/join_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def run_accumulated(self, inputs: List[dict], top_k_join: Optional[int] = None):
"score would be `-infinity`."
)
else:
sorted_docs = [(k, v) for k, v in scores_map.items()]
sorted_docs = list(scores_map.items())

if not top_k_join:
top_k_join = self.top_k_join
Expand Down
5 changes: 1 addition & 4 deletions haystack/nodes/retriever/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,7 @@ def _get_all_paragraphs(self, document_store: BaseDocumentStore, index: Optional
def _calc_scores(self, queries: List[str], index: str) -> List[Dict[int, float]]:
question_vector = self.vectorizer.transform(queries)
doc_scores_per_query = self.tfidf_matrices[index].dot(question_vector.T).T.toarray()
doc_scores_per_query = [
[(doc_idx, doc_score) for doc_idx, doc_score in enumerate(doc_scores)]
for doc_scores in doc_scores_per_query
]
doc_scores_per_query = [list(enumerate(doc_scores)) for doc_scores in doc_scores_per_query]
indices_and_scores: List[Dict] = [
OrderedDict(sorted(query_idx_scores, key=lambda tup: tup[1], reverse=True))
for query_idx_scores in doc_scores_per_query
Expand Down

0 comments on commit 40f3efd

Please sign in to comment.