From c51787c98799c0c02850a2992aa914d8d3d94b54 Mon Sep 17 00:00:00 2001 From: hajdul88 <52442977+hajdul88@users.noreply.github.com> Date: Mon, 6 Oct 2025 18:05:48 +0200 Subject: [PATCH] ruff format --- cognee/infrastructure/databases/cache/RedisAdapter.py | 1 + working_dir_error_replication/reader.py | 2 +- working_dir_error_replication/run_subprocess_test.py | 10 ++++++---- working_dir_error_replication/writer.py | 4 +++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cognee/infrastructure/databases/cache/RedisAdapter.py b/cognee/infrastructure/databases/cache/RedisAdapter.py index 204aa81ff..f486eae22 100644 --- a/cognee/infrastructure/databases/cache/RedisAdapter.py +++ b/cognee/infrastructure/databases/cache/RedisAdapter.py @@ -1,6 +1,7 @@ import redis from contextlib import contextmanager + class RedisAdapter: def __init__(self, host, port, lock_name): self.redis = redis.Redis(host=host, port=port) diff --git a/working_dir_error_replication/reader.py b/working_dir_error_replication/reader.py index caf8407c1..5c54b771b 100644 --- a/working_dir_error_replication/reader.py +++ b/working_dir_error_replication/reader.py @@ -24,4 +24,4 @@ async def main(): if __name__ == "__main__": - asyncio.run(main()) \ No newline at end of file + asyncio.run(main()) diff --git a/working_dir_error_replication/run_subprocess_test.py b/working_dir_error_replication/run_subprocess_test.py index 955e0f3fe..b97154a91 100644 --- a/working_dir_error_replication/run_subprocess_test.py +++ b/working_dir_error_replication/run_subprocess_test.py @@ -6,24 +6,26 @@ import subprocess import time import os + def main(): print("=== Kuzu Subprocess Lock Test ===") print("Starting writer and reader in separate subprocesses...") print("Writer will hold the database lock, reader should block or fail\n") - + start_time = time.time() - + # Start writer subprocess writer_process = subprocess.Popen([os.sys.executable, "writer.py"]) reader_process = subprocess.Popen([os.sys.executable, "reader.py"]) - + # Wait for both processes to complete writer_process.wait() reader_process.wait() - + total_time = time.time() - start_time print(f"\nTotal execution time: {total_time:.2f}s") + if __name__ == "__main__": main() diff --git a/working_dir_error_replication/writer.py b/working_dir_error_replication/writer.py index 928ba4d2a..fb358b886 100644 --- a/working_dir_error_replication/writer.py +++ b/working_dir_error_replication/writer.py @@ -17,6 +17,7 @@ def create_node(name): ) return document + async def main(): adapter = KuzuAdapter("test.db") nodes = [create_node(f"Node{i}") for i in range(200000)] @@ -28,5 +29,6 @@ async def main(): time.sleep(10) + if __name__ == "__main__": - asyncio.run(main()) \ No newline at end of file + asyncio.run(main())