feat: Bump blockbuster version to 1.5.0 (#5292)

* Bump blockbuster version to 1.5.0

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Christophe Bornet 2024-12-17 23:26:18 +01:00 • committed by GitHub
commit c3f36b69a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 36 additions and 9 deletions

View file

@ -1,3 +1,5 @@
import asyncio
from loguru import logger
from langflow.custom.directory_reader import DirectoryReader
@ -83,7 +85,7 @@ def build_custom_component_list_from_path(path: str):
async def abuild_custom_component_list_from_path(path: str):
"""Build a list of custom components for the langchain from a given path."""
file_list = load_files_from_path(path)
file_list = await asyncio.to_thread(load_files_from_path, path)
reader = DirectoryReader(path, compress_code_field=False)
valid_components, invalid_components = await abuild_and_validate_all_files(reader, file_list)

View file

@ -52,6 +52,9 @@ def blockbuster(request):
"io.BufferedWriter.write",
"io.TextIOWrapper.read",
"io.TextIOWrapper.write",
"os.mkdir",
"os.stat",
"os.path.abspath",
]:
bb.functions[func].can_block_functions.append(("settings/service.py", {"initialize"}))
for func in [
@ -59,6 +62,29 @@ def blockbuster(request):
"io.TextIOWrapper.read",
]:
bb.functions[func].can_block_functions.append(("importlib_metadata/__init__.py", {"metadata"}))
# TODO: make set_class_code async
bb.functions["os.stat"].can_block_functions.append(
("langflow/custom/custom_component/component.py", {"set_class_code"})
)
# TODO: follow discussion in https://github.com/encode/httpx/discussions/3456
bb.functions["os.stat"].can_block_functions.append(("httpx/_client.py", {"_init_transport"}))
bb.functions["os.stat"].can_block_functions.append(("linecache.py", {"checkcache", "updatecache"}))
bb.functions["os.stat"].can_block_functions.append(("rich/traceback.py", {"_render_stack"}))
bb.functions["os.stat"].can_block_functions.append(
("langchain_core/_api/internal.py", {"is_caller_internal"})
)
bb.functions["os.path.abspath"].can_block_functions.extend(
[
("loguru/_better_exceptions.py", {"_get_lib_dirs", "_format_exception"}),
("sqlalchemy/dialects/sqlite/pysqlite.py", {"create_connect_args"}),
("_pytest/assertion/rewrite.py", {"_should_rewrite"}),
]
)
bb.functions["os.mkdir"].can_block_functions.append(("_pytest/assertion/rewrite.py", {"try_makedirs"}))
bb.functions["os.replace"].can_block_functions.append(("_pytest/assertion/rewrite.py", {"_write_pyc"}))
yield bb

View file

@ -1,5 +1,4 @@
import tempfile
import aiofiles
import anyio
import pytest
@ -17,7 +16,7 @@ async def test_webhook_endpoint(client, added_webhook_test):
endpoint_name = added_webhook_test["endpoint_name"]
endpoint = f"api/v1/webhook/{endpoint_name}"
# Create a temporary file
with tempfile.TemporaryDirectory() as tmp:
async with aiofiles.tempfile.TemporaryDirectory() as tmp:
file_path = anyio.Path(tmp) / "test_file.txt"
payload = {"path": str(file_path)}