mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 22:44:21 +01:00
Quality update
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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}"""
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user