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.
isort, add proper skips.
BillSchumacher86d3444fb8f9
diff --git a/autogpt/agent/agent.py b/autogpt/agent/agent.pyindex c0bb8d5bc4..6f1e15bef0 100644--- a/autogpt/agent/agent.py+++ b/autogpt/agent/agent.py@@ -3,7 +3,8 @@ from colorama import Fore, Stylefrom autogpt.app import execute_command, get_commandfrom autogpt.chat import chat_with_ai, create_chat_messagefrom autogpt.config import Config-from autogpt.json_fixes.master_json_fix_method import fix_json_using_multiple_techniques+from autogpt.json_fixes.master_json_fix_method import \+ fix_json_using_multiple_techniquesfrom autogpt.json_validation.validate_json import validate_jsonfrom autogpt.logs import logger, print_assistant_thoughtsfrom autogpt.speech import say_textdiff --git a/autogpt/agent/agent_manager.py b/autogpt/agent/agent_manager.pyindex a35da3c2f3..9a62ef61ec 100644--- a/autogpt/agent/agent_manager.py+++ b/autogpt/agent/agent_manager.py@@ -1,9 +1,7 @@"""Agent manager for managing GPT agents"""from __future__ import annotations-from typing import List--from typing import Union+from typing import List, Unionfrom autogpt.config.config import Config, Singletonfrom autogpt.llm_utils import create_chat_completiondiff --git a/autogpt/app.py b/autogpt/app.pyindex 38e9cb5807..10eb98bb3b 100644--- a/autogpt/app.py+++ b/autogpt/app.py@@ -6,22 +6,14 @@ from autogpt.agent.agent_manager import AgentManagerfrom autogpt.commands.audio_text import read_audio_from_filefrom autogpt.commands.command import CommandRegistry, commandfrom autogpt.commands.evaluate_code import evaluate_code-from autogpt.commands.execute_code import (- execute_python_file,- execute_shell,- execute_shell_popen,-)-from autogpt.commands.file_operations import (- append_to_file,- delete_file,- download_file,- read_file,- search_files,- write_to_file,- download_file,-)+from autogpt.commands.execute_code import (execute_python_file, execute_shell,+ execute_shell_popen)+from autogpt.commands.file_operations import (append_to_file, delete_file,+ download_file, read_file,+ search_files, write_to_file)from autogpt.commands.git_operations import clone_repository-from autogpt.commands.google_search import google_official_search, google_search+from autogpt.commands.google_search import (google_official_search,+ google_search)from autogpt.commands.image_gen import generate_imagefrom autogpt.commands.improve_code import improve_codefrom autogpt.commands.twitter import send_tweetdiff --git a/autogpt/cli.py b/autogpt/cli.pyindex aaf1769415..4cf82a6543 100644--- a/autogpt/cli.py+++ b/autogpt/cli.py@@ -74,15 +74,14 @@ def main(from colorama import Forefrom autogpt.agent.agent import Agent-from autogpt.commands.command import CommandRegistryfrom autogpt.config import Config, check_openai_api_keyfrom autogpt.configurator import create_configfrom autogpt.logs import loggerfrom autogpt.memory import get_memory+ from autogpt.plugins import scan_pluginsfrom autogpt.prompts.prompt import construct_main_ai_configfrom autogpt.utils import get_latest_bulletin- from autogpt.plugins import scan_pluginsif ctx.invoked_subcommand is None:cfg = Config()# TODO: fill in llm values herediff --git a/autogpt/commands/file_operations.py b/autogpt/commands/file_operations.pyindex 5bb45179d3..d850ea6717 100644--- a/autogpt/commands/file_operations.py+++ b/autogpt/commands/file_operations.py@@ -10,13 +10,11 @@ import requestsfrom colorama import Back, Forefrom requests.adapters import HTTPAdapter, Retry+from autogpt.commands.command import commandfrom autogpt.spinner import Spinnerfrom autogpt.utils import readable_file_size--from autogpt.commands.command import commandfrom autogpt.workspace import WORKSPACE_PATH, path_in_workspace-LOG_FILE = "file_logger.txt"LOG_FILE_PATH = WORKSPACE_PATH / LOG_FILEdiff --git a/autogpt/commands/web_selenium.py b/autogpt/commands/web_selenium.pyindex ab607f7b9a..e0e0d70ae8 100644--- a/autogpt/commands/web_selenium.py+++ b/autogpt/commands/web_selenium.py@@ -17,8 +17,8 @@ from selenium.webdriver.support.wait import WebDriverWaitfrom webdriver_manager.chrome import ChromeDriverManagerfrom webdriver_manager.firefox import GeckoDriverManager-from autogpt.commands.command import commandimport autogpt.processing.text as summary+from autogpt.commands.command import commandfrom autogpt.config import Configfrom autogpt.processing.html import extract_hyperlinks, format_hyperlinksdiff --git a/autogpt/config/config.py b/autogpt/config/config.pyindex 5c6856f514..af1bcf0db0 100644--- a/autogpt/config/config.py+++ b/autogpt/config/config.py@@ -1,10 +1,10 @@"""Configuration class to store the state of bools for different scripts access."""import os-from typing import List+import openai-from auto_gpt_plugin_template import AutoGPTPluginTemplateimport yaml+from auto_gpt_plugin_template import AutoGPTPluginTemplatefrom colorama import Forefrom dotenv import load_dotenvdiff --git a/autogpt/json_fixes/master_json_fix_method.py b/autogpt/json_fixes/master_json_fix_method.pyindex a77bf670b8..991a95f207 100644--- a/autogpt/json_fixes/master_json_fix_method.py+++ b/autogpt/json_fixes/master_json_fix_method.py@@ -9,9 +9,7 @@ CFG = Config()def fix_json_using_multiple_techniques(assistant_reply: str) -> Dict[Any, Any]:from autogpt.json_fixes.parsing import (- attempt_to_fix_json_by_finding_outermost_brackets,- fix_and_parse_json,- )+ attempt_to_fix_json_by_finding_outermost_brackets, fix_and_parse_json)# Parse and print Assistant responseassistant_reply_json = fix_and_parse_json(assistant_reply)diff --git a/autogpt/llm_utils.py b/autogpt/llm_utils.pyindex 48561da94a..d26fb2d699 100644--- a/autogpt/llm_utils.py+++ b/autogpt/llm_utils.py@@ -8,8 +8,8 @@ from colorama import Fore, Stylefrom openai.error import APIError, RateLimitErrorfrom autogpt.config import Config-from autogpt.types.openai import Messagefrom autogpt.logs import logger+from autogpt.types.openai import MessageCFG = Config()diff --git a/autogpt/logs.py b/autogpt/logs.pyindex df3487f2c1..4ae334329b 100644--- a/autogpt/logs.py+++ b/autogpt/logs.py@@ -204,9 +204,8 @@ logger = Logger()def print_assistant_thoughts(ai_name, assistant_reply):"""Prints the assistant's thoughts to the console"""- from autogpt.json_fixes.bracket_termination import (- attempt_to_fix_json_by_finding_outermost_brackets,- )+ from autogpt.json_fixes.bracket_termination import \+ attempt_to_fix_json_by_finding_outermost_bracketsfrom autogpt.json_fixes.parsing import fix_and_parse_jsontry:diff --git a/autogpt/memory/milvus.py b/autogpt/memory/milvus.pyindex 44aa72b956..e2b8fea8ff 100644--- a/autogpt/memory/milvus.py+++ b/autogpt/memory/milvus.py@@ -1,5 +1,6 @@""" Milvus memory storage provider."""-from pymilvus import Collection, CollectionSchema, DataType, FieldSchema, connections+from pymilvus import (Collection, CollectionSchema, DataType, FieldSchema,+ connections)from autogpt.memory.base import MemoryProviderSingleton, get_ada_embeddingdiff --git a/autogpt/models/base_open_ai_plugin.py b/autogpt/models/base_open_ai_plugin.pyindex fafd39324e..642145998e 100644--- a/autogpt/models/base_open_ai_plugin.py+++ b/autogpt/models/base_open_ai_plugin.py@@ -1,6 +1,5 @@"""Handles loading of plugins."""-from typing import Any, Dict, List, Optional, Tuple, TypedDict-from typing import TypeVar+from typing import Any, Dict, List, Optional, Tuple, TypedDict, TypeVarfrom auto_gpt_plugin_template import AutoGPTPluginTemplatediff --git a/autogpt/plugins.py b/autogpt/plugins.pyindex 0979b8561f..c6324a54db 100644--- a/autogpt/plugins.py+++ b/autogpt/plugins.py@@ -4,20 +4,19 @@ import importlibimport jsonimport osimport zipfile-import openapi_python_client-import requests-from pathlib import Path-from typing import List, Tuple, Optional+from typing import List, Optional, Tuplefrom urllib.parse import urlparsefrom zipimport import zipimporter+import openapi_python_client+import requests+from auto_gpt_plugin_template import AutoGPTPluginTemplatefrom openapi_python_client.cli import Config as OpenAPIConfig+from autogpt.config import Configfrom autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin-from auto_gpt_plugin_template import AutoGPTPluginTemplate-def inspect_zip_for_module(zip_path: str, debug: bool = False) -> Optional[str]:"""diff --git a/autogpt/token_counter.py b/autogpt/token_counter.pyindex b1e59d86df..2d50547b4a 100644--- a/autogpt/token_counter.py+++ b/autogpt/token_counter.py@@ -1,5 +1,6 @@"""Functions for counting the number of tokens in a message or string."""from __future__ import annotations+from typing import Listimport tiktokendiff --git a/pyproject.toml b/pyproject.tomlindex fdb43d66e4..72bb3ff8e0 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -14,6 +14,7 @@ extend-exclude = '.+/(dist|.venv|venv|build)/.+'[tool.isort]profile = "black"+skip = venv,env,node_modules,.env,.venv,distmulti_line_output = 3include_trailing_comma = trueforce_grid_wrap = 0diff --git a/tests/test_commands.py b/tests/test_commands.pyindex 4be41a9080..8a7771f677 100644--- a/tests/test_commands.py+++ b/tests/test_commands.py@@ -1,5 +1,5 @@-import shutilimport os+import shutilimport sysfrom pathlib import Pathdiff --git a/tests/unit/models/test_base_open_api_plugin.py b/tests/unit/models/test_base_open_api_plugin.pyindex 3dc58d5127..8f49c29503 100644--- a/tests/unit/models/test_base_open_api_plugin.py+++ b/tests/unit/models/test_base_open_api_plugin.py@@ -1,6 +1,9 @@-import pytestfrom typing import Any, Dict, List, Optional, Tuple-from autogpt.models.base_open_ai_plugin import BaseOpenAIPlugin, Message, PromptGenerator++import pytest++from autogpt.models.base_open_ai_plugin import (BaseOpenAIPlugin, Message,+ PromptGenerator)class DummyPlugin(BaseOpenAIPlugin):diff --git a/tests/unit/test_plugins.py b/tests/unit/test_plugins.pyindex 58e895bf8f..83656da207 100644--- a/tests/unit/test_plugins.py+++ b/tests/unit/test_plugins.py@@ -1,6 +1,8 @@import pytest-from autogpt.plugins import inspect_zip_for_module, scan_plugins, blacklist_whitelist_check+from autogpt.config import Config+from autogpt.plugins import (blacklist_whitelist_check, inspect_zip_for_module,+ scan_plugins)PLUGINS_TEST_DIR = "tests/unit/data/test_plugins"PLUGIN_TEST_ZIP_FILE = "Auto-GPT-Plugin-Test-master.zip"