Skip to content

Commit ad79cb1

Browse files
author
龚震宇
committed
refactor: streamline import statements across memory management tools
This commit refactors the import statements in several memory management scripts, consolidating imports for better readability and maintainability. The changes include grouping related imports together and removing unnecessary line breaks, enhancing the overall structure of the code without altering functionality.
1 parent 07ba50b commit ad79cb1

4 files changed

Lines changed: 22 additions & 30 deletions

File tree

tools/delete_memory.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@
99
from dify_plugin import Tool
1010

1111
from utils.config_builder import is_async_mode
12-
from utils.constants import DELETE_ACCEPT_RESULT, MAX_PENDING_TASKS_MULTIPLIER, WRITE_OPERATION_TIMEOUT
12+
from utils.constants import (
13+
DELETE_ACCEPT_RESULT,
14+
MAX_PENDING_TASKS_MULTIPLIER,
15+
WRITE_OPERATION_TIMEOUT,
16+
)
1317
from utils.helpers import parse_timeout
1418
from utils.logger import get_logger
15-
from utils.mem0_client import (
16-
get_async_client,
17-
get_sync_client,
18-
)
19-
from utils.memory_tool_helpers import (
20-
init_request_context,
21-
yield_error,
22-
)
19+
from utils.mem0_client import get_async_client, get_sync_client
20+
from utils.memory_tool_helpers import init_request_context, yield_error
2321

2422
if TYPE_CHECKING:
2523
from collections.abc import Generator

tools/extract_long_term_memory.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@
5656
get_time_range_from_days,
5757
update_conv_checkpoint,
5858
)
59-
from utils.helpers import _parse_user_ids, dedup_keep_order
60-
from utils.helpers import parse_positive_int
61-
from utils.logger import get_logger
62-
from utils.mem0_client import (
63-
AsyncMem0Client,
64-
SyncMem0Client,
59+
from utils.helpers import (
60+
_parse_user_ids,
61+
dedup_keep_order,
62+
parse_positive_int,
6563
)
64+
from utils.logger import get_logger
65+
from utils.mem0_client import AsyncMem0Client, SyncMem0Client
6666
from utils.mem0_extraction import (
6767
AsyncMemoryClassificationManager,
6868
AsyncMemoryWriter,

tools/update_memory.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,15 @@
1010
from dify_plugin import Tool
1111

1212
from utils.config_builder import is_async_mode
13-
from utils.constants import MAX_PENDING_TASKS_MULTIPLIER, UPDATE_ACCEPT_RESULT, WRITE_OPERATION_TIMEOUT
13+
from utils.constants import (
14+
MAX_PENDING_TASKS_MULTIPLIER,
15+
UPDATE_ACCEPT_RESULT,
16+
WRITE_OPERATION_TIMEOUT,
17+
)
1418
from utils.helpers import parse_timeout
1519
from utils.logger import get_logger
16-
from utils.mem0_client import (
17-
get_async_client,
18-
get_sync_client,
19-
)
20-
from utils.memory_tool_helpers import (
21-
init_request_context,
22-
yield_error,
23-
)
20+
from utils.mem0_client import get_async_client, get_sync_client
21+
from utils.memory_tool_helpers import init_request_context, yield_error
2422

2523
if TYPE_CHECKING:
2624
from collections.abc import Generator

utils/memory_tool_helpers.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@
1212
from concurrent.futures import TimeoutError as FuturesTimeoutError
1313
from typing import TYPE_CHECKING, Any
1414

15-
from utils.logger import get_logger
1615
from utils.constants import MAX_PENDING_TASKS_MULTIPLIER
17-
from utils.mem0_client import (
18-
QueueOverloadError,
19-
get_async_client,
20-
get_sync_client,
21-
)
16+
from utils.logger import get_logger
17+
from utils.mem0_client import QueueOverloadError, get_async_client, get_sync_client
2218

2319
if TYPE_CHECKING:
2420
from collections.abc import Generator

0 commit comments

Comments
 (0)