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