mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-13 05:25:07 +00:00
chore(langchain): add ruff rule ERA (#32867)
This commit is contained in:
committed by
GitHub
parent
00f699c60d
commit
699a5d06d1
@@ -85,10 +85,10 @@ def create_importer(
|
||||
and deprecated_lookups
|
||||
and name in deprecated_lookups
|
||||
# Depth 3:
|
||||
# internal.py
|
||||
# module_import.py
|
||||
# Module in langchain that uses this function
|
||||
# [calling code] whose frame we want to inspect.
|
||||
# -> internal.py
|
||||
# |-> module_import.py
|
||||
# |-> Module in langchain that uses this function
|
||||
# |-> [calling code] whose frame we want to inspect.
|
||||
and not internal.is_caller_internal(depth=3)
|
||||
):
|
||||
warn_deprecated(
|
||||
@@ -120,9 +120,9 @@ def create_importer(
|
||||
not is_interactive_env()
|
||||
# Depth 3:
|
||||
# internal.py
|
||||
# module_import.py
|
||||
# Module in langchain that uses this function
|
||||
# [calling code] whose frame we want to inspect.
|
||||
# |-> module_import.py
|
||||
# |->Module in langchain that uses this function
|
||||
# |-> [calling code] whose frame we want to inspect.
|
||||
and not internal.is_caller_internal(depth=3)
|
||||
):
|
||||
warn_deprecated(
|
||||
|
@@ -160,11 +160,10 @@ ignore = [
|
||||
"TD003", # Missing issue link in TODO
|
||||
|
||||
# TODO rules
|
||||
"ANN401",
|
||||
"BLE",
|
||||
"ANN401", # No type Any
|
||||
"BLE", # Blind exceptions
|
||||
"D100", # pydocstyle: missing docstring in public module
|
||||
"D104", # pydocstyle: missing docstring in public package
|
||||
"ERA",
|
||||
"PLC0415", # pylint: import-outside-top-level
|
||||
"TRY301", # tryceratops: raise-within-try
|
||||
]
|
||||
|
@@ -33,7 +33,7 @@ Rating: 10"""
|
||||
|
||||
text = """This answer is really good.
|
||||
Rating: [[0]]"""
|
||||
# Not in range [1, 10]
|
||||
# Rating is not in range [1, 10]
|
||||
with pytest.raises(ValueError, match="with the verdict between 1 and 10"):
|
||||
output_parser.parse(text)
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
"""Test for CombinedMemory class."""
|
||||
|
||||
# from langchain_core.prompts import PromptTemplate
|
||||
|
||||
import pytest
|
||||
|
||||
from langchain.memory import CombinedMemory, ConversationBufferMemory
|
||||
|
@@ -76,7 +76,7 @@ def test_multi_vector_retriever_similarity_search_with_score() -> None:
|
||||
vectorstore = InMemoryVectorstoreWithSearch()
|
||||
vectorstore.add_documents(documents, ids=["1"])
|
||||
|
||||
# score_threshold = 0.5
|
||||
# test with score_threshold = 0.5
|
||||
retriever = MultiVectorRetriever(
|
||||
vectorstore=vectorstore,
|
||||
docstore=InMemoryStore(),
|
||||
@@ -89,7 +89,7 @@ def test_multi_vector_retriever_similarity_search_with_score() -> None:
|
||||
assert len(results) == 1
|
||||
assert results[0].page_content == "test document"
|
||||
|
||||
# score_threshold = 0.9
|
||||
# test with score_threshold = 0.9
|
||||
retriever = MultiVectorRetriever(
|
||||
vectorstore=vectorstore,
|
||||
docstore=InMemoryStore(),
|
||||
@@ -107,7 +107,7 @@ async def test_multi_vector_retriever_similarity_search_with_score_async() -> No
|
||||
vectorstore = InMemoryVectorstoreWithSearch()
|
||||
await vectorstore.aadd_documents(documents, ids=["1"])
|
||||
|
||||
# score_threshold = 0.5
|
||||
# test with score_threshold = 0.5
|
||||
retriever = MultiVectorRetriever(
|
||||
vectorstore=vectorstore,
|
||||
docstore=InMemoryStore(),
|
||||
@@ -120,7 +120,7 @@ async def test_multi_vector_retriever_similarity_search_with_score_async() -> No
|
||||
assert len(results) == 1
|
||||
assert results[0].page_content == "test document"
|
||||
|
||||
# score_threshold = 0.9
|
||||
# test with score_threshold = 0.9
|
||||
retriever = MultiVectorRetriever(
|
||||
vectorstore=vectorstore,
|
||||
docstore=InMemoryStore(),
|
||||
|
Reference in New Issue
Block a user