Quality update

This commit is contained in:
BillSchumacher
2023-04-15 14:55:13 -05:00
parent 82f53aae54
commit 11d6dabe37
15 changed files with 161 additions and 91 deletions

View File

@@ -99,8 +99,8 @@ def execute_shell(command_line: str) -> str:
str: The output of the command
"""
current_dir = os.getcwd()
if str(WORKING_DIRECTORY) not in current_dir: # Change dir into workspace if necessary
# Change dir into workspace if necessary
if str(WORKING_DIRECTORY) not in current_dir:
work_dir = os.path.join(os.getcwd(), WORKING_DIRECTORY)
os.chdir(work_dir)

View File

@@ -1,14 +1,20 @@
"""Git operations for autogpt"""
import git
from autogpt.config import Config
cfg = Config()
CFG = Config()
def clone_repository(repo_url, clone_path):
"""Clone a github repository locally"""
def clone_repository(repo_url: str, clone_path: str) -> str:
"""Clone a github repository locally
Args:
repo_url (str): The URL of the repository to clone
clone_path (str): The path to clone the repository to
Returns:
str: The result of the clone operation"""
split_url = repo_url.split("//")
auth_repo_url = f"//{cfg.github_username}:{cfg.github_api_key}@".join(split_url)
auth_repo_url = f"//{CFG.github_username}:{CFG.github_api_key}@".join(split_url)
git.Repo.clone_from(auth_repo_url, clone_path)
result = f"""Cloned {repo_url} to {clone_path}"""
return result
return f"""Cloned {repo_url} to {clone_path}"""

View File

@@ -53,7 +53,11 @@ def scrape_text_with_selenium(url: str) -> Tuple[WebDriver, str]:
"""
logging.getLogger("selenium").setLevel(logging.CRITICAL)
options_available = {'chrome': ChromeOptions, 'safari': SafariOptions, 'firefox': FirefoxOptions}
options_available = {
"chrome": ChromeOptions,
"safari": SafariOptions,
"firefox": FirefoxOptions,
}
options = options_available[CFG.selenium_web_browser]()
options.add_argument(