AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
linting
BillSchumacher6e94409594b0
diff --git a/autogpt/json_utils/json_fix_general.py b/autogpt/json_utils/json_fix_general.pyindex cd6a688411..7010fa3b9c 100644--- a/autogpt/json_utils/json_fix_general.py+++ b/autogpt/json_utils/json_fix_general.py@@ -27,7 +27,7 @@ def fix_invalid_escape(json_to_load: str, error_message: str) -> str:while error_message.startswith("Invalid \\escape"):bad_escape_location = extract_char_position(error_message)json_to_load = (- json_to_load[:bad_escape_location] + json_to_load[bad_escape_location + 1:]+ json_to_load[:bad_escape_location] + json_to_load[bad_escape_location + 1 :])try:json.loads(json_to_load)@@ -109,7 +109,7 @@ def correct_json(json_to_load: str) -> str:if error_message.startswith("Invalid \\escape"):json_to_load = fix_invalid_escape(json_to_load, error_message)if error_message.startswith(- "Expecting property name enclosed in double quotes"+ "Expecting property name enclosed in double quotes"):json_to_load = add_quotes_to_property_names(json_to_load)try:diff --git a/autogpt/json_utils/json_fix_llm.py b/autogpt/json_utils/json_fix_llm.pyindex 44e78d0525..869aed125c 100644--- a/autogpt/json_utils/json_fix_llm.py+++ b/autogpt/json_utils/json_fix_llm.py@@ -4,16 +4,16 @@ from __future__ import annotationsimport contextlibimport json-from typing import Dict, Any+from typing import Any, Dictfrom colorama import Forefrom regex import regex+from autogpt.config import Configfrom autogpt.json_utils.json_fix_general import correct_jsonfrom autogpt.llm_utils import call_ai_functionfrom autogpt.logs import loggerfrom autogpt.speech import say_text-from autogpt.config import ConfigJSON_SCHEMA = """{@@ -102,7 +102,10 @@ def fix_json_using_multiple_techniques(assistant_reply: str) -> Dict[Any, Any]:if assistant_reply_json != {}:return assistant_reply_json- logger.error("Error: The following AI output couldn't be converted to a JSON:\n", assistant_reply)+ logger.error(+ "Error: The following AI output couldn't be converted to a JSON:\n",+ assistant_reply,+ )if CFG.speak_mode:say_text("I have received an invalid JSON response from the OpenAI API.")diff --git a/autogpt/json_utils/utilities.py b/autogpt/json_utils/utilities.pyindex 8499ddc853..eb9bb68775 100644--- a/autogpt/json_utils/utilities.py+++ b/autogpt/json_utils/utilities.py@@ -4,8 +4,8 @@ import refrom jsonschema import Draft7Validator-from autogpt.logs import loggerfrom autogpt.config import Config+from autogpt.logs import loggerCFG = Config()diff --git a/autogpt/logs.py b/autogpt/logs.pyindex 50fe012829..35037404a9 100644--- a/autogpt/logs.py+++ b/autogpt/logs.py@@ -204,7 +204,10 @@ logger = Logger()def print_assistant_thoughts(ai_name, assistant_reply):"""Prints the assistant's thoughts to the console"""- from autogpt.json_utils.json_fix_llm import fix_and_parse_json, attempt_to_fix_json_by_finding_outermost_brackets+ from autogpt.json_utils.json_fix_llm import (+ attempt_to_fix_json_by_finding_outermost_brackets,+ fix_and_parse_json,+ )try:try: