From 5733f0418d87b2ebacfad2a3a776fe67e79d43b2 Mon Sep 17 00:00:00 2001 From: Max Blackmer Date: Tue, 26 Dec 2023 08:52:24 -0500 Subject: [PATCH] [cpacker#319] Refactor memgptlog.py to log.py and move a function to log.py --- memgpt/cli/cli.py | 2 +- memgpt/cli/cli_config.py | 2 +- memgpt/config.py | 2 +- memgpt/{memgptlog.py => log.py} | 8 ++++++++ memgpt/main.py | 2 +- memgpt/utils.py | 8 -------- 6 files changed, 12 insertions(+), 12 deletions(-) rename memgpt/{memgptlog.py => log.py} (57%) diff --git a/memgpt/cli/cli.py b/memgpt/cli/cli.py index 9196baec..93b9b305 100644 --- a/memgpt/cli/cli.py +++ b/memgpt/cli/cli.py @@ -13,7 +13,7 @@ from enum import Enum from llama_index import set_global_service_context from llama_index import ServiceContext -from memgpt.memgptlog import logger +from memgpt.log import logger from memgpt.interface import CLIInterface as interface # for printing to terminal from memgpt.cli.cli_config import configure import memgpt.presets.presets as presets diff --git a/memgpt/cli/cli_config.py b/memgpt/cli/cli_config.py index 4b2cc55f..8203a5e5 100644 --- a/memgpt/cli/cli_config.py +++ b/memgpt/cli/cli_config.py @@ -6,7 +6,7 @@ import os import shutil # from global logging configuration -from memgpt.memgptlog import logger +from memgpt.log import logger # from memgpt.cli import app from memgpt import utils diff --git a/memgpt/config.py b/memgpt/config.py index d81f76e2..804e7bf3 100644 --- a/memgpt/config.py +++ b/memgpt/config.py @@ -1,6 +1,6 @@ import logging import logging.config -from memgpt.memgptlog import logger, reload_logger +from memgpt.log import logger, reload_logger, fix_file_path import inspect import json import os diff --git a/memgpt/memgptlog.py b/memgpt/log.py similarity index 57% rename from memgpt/memgptlog.py rename to memgpt/log.py index 38ae260f..8151cd99 100644 --- a/memgpt/memgptlog.py +++ b/memgpt/log.py @@ -10,3 +10,11 @@ def reload_logger(): global logger # This is required to modify the global 'logger' # Reconfigure logger logger = logging.getLogger(LOGGER_NAME) + + +def fix_file_path(path): + """ + Converts backslashes to forward slashes in a file path. + This is useful for ensuring compatibility in file paths across different systems. + """ + return path.replace("\\", "/") diff --git a/memgpt/main.py b/memgpt/main.py index 19ff43c8..d5c2335e 100644 --- a/memgpt/main.py +++ b/memgpt/main.py @@ -17,7 +17,7 @@ from prettytable import PrettyTable console = Console() -from memgpt.memgptlog import logger +from memgpt.log import logger from memgpt.interface import CLIInterface as interface # for printing to terminal import memgpt.agent as agent import memgpt.system as system diff --git a/memgpt/utils.py b/memgpt/utils.py index 5b720d83..8e864a42 100644 --- a/memgpt/utils.py +++ b/memgpt/utils.py @@ -288,11 +288,3 @@ def get_schema_diff(schema_a, schema_b): difference = [line for line in difference if line.startswith("+ ") or line.startswith("- ")] return "".join(difference) - - -def fix_file_path(path): - """ - Converts backslashes to forward slashes in a file path. - This is useful for ensuring compatibility in file paths across different systems. - """ - return path.replace("\\", "/")