From d07d103db920f27f8c8b94429af5c20096df0585 Mon Sep 17 00:00:00 2001 From: aries-ckt <916701291@qq.com> Date: Wed, 14 Jun 2023 22:22:27 +0800 Subject: [PATCH] fix:format --- pilot/common/plugins.py | 14 +++++++++----- pilot/configs/config.py | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pilot/common/plugins.py b/pilot/common/plugins.py index 832144d22..e22224399 100644 --- a/pilot/common/plugins.py +++ b/pilot/common/plugins.py @@ -78,6 +78,7 @@ def load_native_plugins(cfg: Config): if not cfg.plugins_auto_load: print("not auto load_native_plugins") return + def load_from_git(cfg: Config): print("async load_native_plugins") branch_name = cfg.plugins_git_branch @@ -85,16 +86,20 @@ def load_native_plugins(cfg: Config): url = "https://github.com/csunny/{repo}/archive/{branch}.zip" try: session = requests.Session() - response = session.get(url.format(repo=native_plugin_repo, branch=branch_name), - headers={'Authorization': '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'}) + response = session.get( + url.format(repo=native_plugin_repo, branch=branch_name), + headers={"Authorization": "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"}, + ) if response.status_code == 200: plugins_path_path = Path(PLUGINS_DIR) - files = glob.glob(os.path.join(plugins_path_path, f'{native_plugin_repo}*')) + files = glob.glob( + os.path.join(plugins_path_path, f"{native_plugin_repo}*") + ) for file in files: os.remove(file) now = datetime.datetime.now() - time_str = now.strftime('%Y%m%d%H%M%S') + time_str = now.strftime("%Y%m%d%H%M%S") file_name = f"{plugins_path_path}/{native_plugin_repo}-{branch_name}-{time_str}.zip" print(file_name) with open(file_name, "wb") as f: @@ -110,7 +115,6 @@ def load_native_plugins(cfg: Config): t.start() - def scan_plugins(cfg: Config, debug: bool = False) -> List[AutoGPTPluginTemplate]: """Scan the plugins directory for plugins and loads them. diff --git a/pilot/configs/config.py b/pilot/configs/config.py index 6db040a9d..9e6542db9 100644 --- a/pilot/configs/config.py +++ b/pilot/configs/config.py @@ -90,7 +90,7 @@ class Config(metaclass=Singleton): ### The associated configuration parameters of the plug-in control the loading and use of the plug-in self.plugins: List[AutoGPTPluginTemplate] = [] self.plugins_openai = [] - self.plugins_auto_load = os.getenv("AUTO_LOAD_PLUGIN", "True") == "True" + self.plugins_auto_load = os.getenv("AUTO_LOAD_PLUGIN", "True") == "True" self.plugins_git_branch = os.getenv("PLUGINS_GIT_BRANCH", "plugin_dashboard")