remove bare list, dict, Sequence, None, Any (#25058)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
@@ -14,7 +14,7 @@ from services.account_service import AccountService, RegisterService
|
||||
|
||||
|
||||
# Loading the .env file if it exists
|
||||
def _load_env() -> None:
|
||||
def _load_env():
|
||||
current_file_path = pathlib.Path(__file__).absolute()
|
||||
# Items later in the list have higher precedence.
|
||||
files_to_load = [".env", "vdb.env"]
|
||||
|
||||
@@ -17,7 +17,7 @@ def mock_plugin_daemon(
|
||||
:return: unpatch function
|
||||
"""
|
||||
|
||||
def unpatch() -> None:
|
||||
def unpatch():
|
||||
monkeypatch.undo()
|
||||
|
||||
monkeypatch.setattr(PluginModelClient, "invoke_llm", MockModelClass.invoke_llm)
|
||||
|
||||
@@ -150,7 +150,7 @@ class MockTcvectordbClass:
|
||||
filter: Optional[Filter] = None,
|
||||
output_fields: Optional[list[str]] = None,
|
||||
timeout: Optional[float] = None,
|
||||
) -> list[dict]:
|
||||
):
|
||||
return [{"metadata": '{"doc_id":"foo1"}', "text": "text", "doc_id": "foo1", "score": 0.1}]
|
||||
|
||||
def collection_delete(
|
||||
@@ -163,7 +163,7 @@ class MockTcvectordbClass:
|
||||
):
|
||||
return {"code": 0, "msg": "operation success"}
|
||||
|
||||
def drop_collection(self, database_name: str, collection_name: str, timeout: Optional[float] = None) -> dict:
|
||||
def drop_collection(self, database_name: str, collection_name: str, timeout: Optional[float] = None):
|
||||
return {"code": 0, "msg": "operation success"}
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ def get_example_document(doc_id: str) -> Document:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def setup_mock_redis() -> None:
|
||||
def setup_mock_redis():
|
||||
# get
|
||||
ext_redis.redis_client.get = MagicMock(return_value=None)
|
||||
|
||||
@@ -48,7 +48,7 @@ class AbstractVectorTest:
|
||||
self.example_doc_id = str(uuid.uuid4())
|
||||
self.example_embedding = [1.001 * i for i in range(128)]
|
||||
|
||||
def create_vector(self) -> None:
|
||||
def create_vector(self):
|
||||
self.vector.create(
|
||||
texts=[get_example_document(doc_id=self.example_doc_id)],
|
||||
embeddings=[self.example_embedding],
|
||||
|
||||
@@ -12,7 +12,7 @@ MOCK = os.getenv("MOCK_SWITCH", "false") == "true"
|
||||
|
||||
class MockedCodeExecutor:
|
||||
@classmethod
|
||||
def invoke(cls, language: Literal["python3", "javascript", "jinja2"], code: str, inputs: dict) -> dict:
|
||||
def invoke(cls, language: Literal["python3", "javascript", "jinja2"], code: str, inputs: dict):
|
||||
# invoke directly
|
||||
match language:
|
||||
case CodeLanguage.PYTHON3:
|
||||
|
||||
@@ -74,7 +74,7 @@ def init_code_node(code_config: dict):
|
||||
@pytest.mark.parametrize("setup_code_executor_mock", [["none"]], indirect=True)
|
||||
def test_execute_code(setup_code_executor_mock):
|
||||
code = """
|
||||
def main(args1: int, args2: int) -> dict:
|
||||
def main(args1: int, args2: int):
|
||||
return {
|
||||
"result": args1 + args2,
|
||||
}
|
||||
@@ -120,7 +120,7 @@ def test_execute_code(setup_code_executor_mock):
|
||||
@pytest.mark.parametrize("setup_code_executor_mock", [["none"]], indirect=True)
|
||||
def test_execute_code_output_validator(setup_code_executor_mock):
|
||||
code = """
|
||||
def main(args1: int, args2: int) -> dict:
|
||||
def main(args1: int, args2: int):
|
||||
return {
|
||||
"result": args1 + args2,
|
||||
}
|
||||
@@ -163,7 +163,7 @@ def test_execute_code_output_validator(setup_code_executor_mock):
|
||||
|
||||
def test_execute_code_output_validator_depth():
|
||||
code = """
|
||||
def main(args1: int, args2: int) -> dict:
|
||||
def main(args1: int, args2: int):
|
||||
return {
|
||||
"result": {
|
||||
"result": args1 + args2,
|
||||
@@ -281,7 +281,7 @@ def test_execute_code_output_validator_depth():
|
||||
|
||||
def test_execute_code_output_object_list():
|
||||
code = """
|
||||
def main(args1: int, args2: int) -> dict:
|
||||
def main(args1: int, args2: int):
|
||||
return {
|
||||
"result": {
|
||||
"result": args1 + args2,
|
||||
@@ -356,7 +356,7 @@ def test_execute_code_output_object_list():
|
||||
|
||||
def test_execute_code_scientific_notation():
|
||||
code = """
|
||||
def main() -> dict:
|
||||
def main():
|
||||
return {
|
||||
"result": -8.0E-5
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user