unify annotations to future syntax

This commit is contained in:
jayceslesar
2023-04-16 14:02:48 -04:00
parent 35175fc19b
commit 8990911522
19 changed files with 83 additions and 60 deletions

View File

@@ -1,4 +1,6 @@
"""Selenium web scraping module."""
from __future__ import annotations
from selenium import webdriver
from autogpt.processing.html import extract_hyperlinks, format_hyperlinks
import autogpt.processing.text as summary
@@ -15,13 +17,12 @@ from selenium.webdriver.safari.options import Options as SafariOptions
import logging
from pathlib import Path
from autogpt.config import Config
from typing import List, Tuple, Union
FILE_DIR = Path(__file__).parent.parent
CFG = Config()
def browse_website(url: str, question: str) -> Tuple[str, WebDriver]:
def browse_website(url: str, question: str) -> tuple[str, WebDriver]:
"""Browse a website and return the answer and links to the user
Args:
@@ -43,7 +44,7 @@ def browse_website(url: str, question: str) -> Tuple[str, WebDriver]:
return f"Answer gathered from website: {summary_text} \n \n Links: {links}", driver
def scrape_text_with_selenium(url: str) -> Tuple[WebDriver, str]:
def scrape_text_with_selenium(url: str) -> tuple[WebDriver, str]:
"""Scrape text from a website using selenium
Args:
@@ -97,7 +98,7 @@ def scrape_text_with_selenium(url: str) -> Tuple[WebDriver, str]:
return driver, text
def scrape_links_with_selenium(driver: WebDriver, url: str) -> List[str]:
def scrape_links_with_selenium(driver: WebDriver, url: str) -> list[str]:
"""Scrape links from a website using selenium
Args: