Merge pull request #712 from nponeccop/pr-whitespace2

Remove trailing whitespace throughout
This commit is contained in:
Toran Bruce Richards
2023-04-10 23:02:31 +01:00
committed by GitHub
4 changed files with 13 additions and 13 deletions

View File

@@ -34,7 +34,7 @@ class AIConfig:
@classmethod @classmethod
def load(cls: object, config_file: str=SAVE_FILE) -> object: def load(cls: object, config_file: str=SAVE_FILE) -> object:
""" """
Returns class object with parameters (ai_name, ai_role, ai_goals) loaded from yaml file if yaml file exists, Returns class object with parameters (ai_name, ai_role, ai_goals) loaded from yaml file if yaml file exists,
else returns class with no parameters. else returns class with no parameters.
Parameters: Parameters:
@@ -42,7 +42,7 @@ class AIConfig:
config_file (int): The path to the config yaml file. DEFAULT: "../ai_settings.yaml" config_file (int): The path to the config yaml file. DEFAULT: "../ai_settings.yaml"
Returns: Returns:
cls (object): A instance of given cls object cls (object): A instance of given cls object
""" """
try: try:
@@ -61,11 +61,11 @@ class AIConfig:
""" """
Saves the class parameters to the specified file yaml file path as a yaml file. Saves the class parameters to the specified file yaml file path as a yaml file.
Parameters: Parameters:
config_file(str): The path to the config yaml file. DEFAULT: "../ai_settings.yaml" config_file(str): The path to the config yaml file. DEFAULT: "../ai_settings.yaml"
Returns: Returns:
None None
""" """
config = {"ai_name": self.ai_name, "ai_role": self.ai_role, "ai_goals": self.ai_goals} config = {"ai_name": self.ai_name, "ai_role": self.ai_role, "ai_goals": self.ai_goals}
@@ -76,7 +76,7 @@ class AIConfig:
""" """
Returns a prompt to the user with the class information in an organized fashion. Returns a prompt to the user with the class information in an organized fashion.
Parameters: Parameters:
None None
Returns: Returns:

View File

@@ -27,7 +27,7 @@ def evaluate_code(code: str) -> List[str]:
def improve_code(suggestions: List[str], code: str) -> str: def improve_code(suggestions: List[str], code: str) -> str:
""" """
A function that takes in code and suggestions and returns a response from create chat completion api call. A function that takes in code and suggestions and returns a response from create chat completion api call.
Parameters: Parameters:
suggestions (List): A list of suggestions around what needs to be improved. suggestions (List): A list of suggestions around what needs to be improved.

View File

@@ -37,7 +37,7 @@ class Config(metaclass=Singleton):
self.continuous_mode = False self.continuous_mode = False
self.speak_mode = False self.speak_mode = False
self.fast_llm_model = os.getenv("FAST_LLM_MODEL", "gpt-3.5-turbo") self.fast_llm_model = os.getenv("FAST_LLM_MODEL", "gpt-3.5-turbo")
self.smart_llm_model = os.getenv("SMART_LLM_MODEL", "gpt-4") self.smart_llm_model = os.getenv("SMART_LLM_MODEL", "gpt-4")
self.fast_token_limit = int(os.getenv("FAST_TOKEN_LIMIT", 4000)) self.fast_token_limit = int(os.getenv("FAST_TOKEN_LIMIT", 4000))
self.smart_token_limit = int(os.getenv("SMART_TOKEN_LIMIT", 8000)) self.smart_token_limit = int(os.getenv("SMART_TOKEN_LIMIT", 8000))

View File

@@ -37,7 +37,7 @@ Additional aspects:
class TestScrapeText: class TestScrapeText:
# Tests that scrape_text() returns the expected text when given a valid URL. # Tests that scrape_text() returns the expected text when given a valid URL.
def test_scrape_text_with_valid_url(self, mocker): def test_scrape_text_with_valid_url(self, mocker):
# Mock the requests.get() method to return a response with expected text # Mock the requests.get() method to return a response with expected text
expected_text = "This is some sample text" expected_text = "This is some sample text"
@@ -50,7 +50,7 @@ class TestScrapeText:
url = "http://www.example.com" url = "http://www.example.com"
assert scrape_text(url) == expected_text assert scrape_text(url) == expected_text
# Tests that the function returns an error message when an invalid or unreachable url is provided. # Tests that the function returns an error message when an invalid or unreachable url is provided.
def test_invalid_url(self, mocker): def test_invalid_url(self, mocker):
# Mock the requests.get() method to raise an exception # Mock the requests.get() method to raise an exception
mocker.patch("requests.get", side_effect=requests.exceptions.RequestException) mocker.patch("requests.get", side_effect=requests.exceptions.RequestException)
@@ -60,7 +60,7 @@ class TestScrapeText:
error_message = scrape_text(url) error_message = scrape_text(url)
assert "Error:" in error_message assert "Error:" in error_message
# Tests that the function returns an empty string when the html page contains no text to be scraped. # Tests that the function returns an empty string when the html page contains no text to be scraped.
def test_no_text(self, mocker): def test_no_text(self, mocker):
# Mock the requests.get() method to return a response with no text # Mock the requests.get() method to return a response with no text
mock_response = mocker.Mock() mock_response = mocker.Mock()
@@ -72,7 +72,7 @@ class TestScrapeText:
url = "http://www.example.com" url = "http://www.example.com"
assert scrape_text(url) == "" assert scrape_text(url) == ""
# Tests that the function returns an error message when the response status code is an http error (>=400). # Tests that the function returns an error message when the response status code is an http error (>=400).
def test_http_error(self, mocker): def test_http_error(self, mocker):
# Mock the requests.get() method to return a response with a 404 status code # Mock the requests.get() method to return a response with a 404 status code
mocker.patch('requests.get', return_value=mocker.Mock(status_code=404)) mocker.patch('requests.get', return_value=mocker.Mock(status_code=404))
@@ -83,7 +83,7 @@ class TestScrapeText:
# Check that the function returns an error message # Check that the function returns an error message
assert result == "Error: HTTP 404 error" assert result == "Error: HTTP 404 error"
# Tests that scrape_text() properly handles HTML tags. # Tests that scrape_text() properly handles HTML tags.
def test_scrape_text_with_html_tags(self, mocker): def test_scrape_text_with_html_tags(self, mocker):
# Create a mock response object with HTML containing tags # Create a mock response object with HTML containing tags
html = "<html><body><p>This is <b>bold</b> text.</p></body></html>" html = "<html><body><p>This is <b>bold</b> text.</p></body></html>"
@@ -96,4 +96,4 @@ class TestScrapeText:
result = scrape_text("https://www.example.com") result = scrape_text("https://www.example.com")
# Check that the function properly handles HTML tags # Check that the function properly handles HTML tags
assert result == "This is bold text." assert result == "This is bold text."